Re: [PATCH v4 6/6] scsi: ufs: core: Do not release a reserved request in ufshcd_abort()
From: Peter Wang
Date: Wed Oct 21 2026 - 09:13:26 EST
On Wed, 2026-10-21 at 12:06 +0800, Stanley Jhu wrote:
> In SDB mode, aborting a timed-out device management request drops a
> clock hold that the request never took:
>
> 1. ufshcd_dev_man_lock() takes one ufshcd_hold() for the whole device
> management command. ufshcd_queue_reserved_command() submits the
> request without taking a hold of its own.
> 2. The request times out and ufshcd_abort() clears its slot with
> ufshcd_clear_cmd().
> 3. ufshcd_abort() claims BIT(tag) in hba->outstanding_reqs and calls
> ufshcd_release_scsi_cmd(), which calls ufshcd_release() for a hold
> the request never took.
> 4. When ufshcd_dev_man_unlock() drops the hold from step 1,
> hba->clk_gating.active_reqs goes below zero.
>
> Release the command only if it is a SCSI command.
>
> Fixes: 08b12cda6c44 ("scsi: ufs: core: Switch to
> scsi_get_internal_cmd()")
> Cc: stable@xxxxxxxxxxxxxxx
> Link:
> https://lore.kernel.org/r/2060a8da-581b-46d1-a510-779f4df716cd@xxxxxxx
>
> Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>
> Signed-off-by: Stanley Jhu <stanleyjhu@xxxxxxxxxx>
> ---
Reviewed-by: Peter Wang <peter.wang@xxxxxxxxxxxx>