From: sashiko-bot@kernel.org
To: "Bart Van Assche" <bvanassche@acm.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/3] ufs: core: Simplify timeout handling for START STOP UNIT commands
Date: Wed, 12 Aug 2026 18:40:15 +0000 [thread overview]
Message-ID: <20260812184015.88A821F000E9@smtp.kernel.org> (raw)
In-Reply-To: <0a0a8245594f992a2318caf14164491974e79c46.1786558726.git.bvanassche@acm.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Replacing DID_REQUEUE with DID_TIME_OUT for START STOP UNIT commands inadvertently routes them to the SCSI Error Handler, risking deadlock and breaking PM recovery.
--
--- Patch [1]: [PATCH 1/3] ufs: core: Simplify timeout handling for START STOP UNIT commands ---
commit 457c19a7449f41757fe8a8fc3aa57e02dd255499
Author: Bart Van Assche <bvanassche@acm.org>
ufs: core: Simplify timeout handling for START STOP UNIT commands
This commit simplifies timeout handling for START STOP UNIT commands by failing
them directly instead of requeuing them. It updates the ufshcd_eh_timed_out
handler to use DID_TIME_OUT rather than DID_REQUEUE for SCSI commands.
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -9572,13 +9572,9 @@ static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd)
> spin_unlock_irqrestore(&hba->outstanding_lock, flags);
> }
>
> - if (ufshcd_is_scsi_cmd(scmd)) {
> - set_host_byte(scmd, DID_REQUEUE);
> + set_host_byte(scmd, DID_TIME_OUT);
[Severity: High]
Will this inadvertently route START STOP UNIT commands to the SCSI Error
Handler and risk deadlocks during PM recovery?
Looking at scsi_decide_disposition(), setting DID_TIME_OUT for commands other
than INQUIRY or TEST_UNIT_READY (such as START STOP UNIT, opcode 0x1B)
evaluates to FAILED. The SCSI core then proceeds to call scsi_eh_scmd_add(),
which flags the host for SHOST_RECOVERY and wakes the SCSI Error Handler
thread.
Waking the EH thread during PM transitions appears to break the UFS
subsystem's custom inline recovery and reintroduces the deadlocks that commit
01d5e237b339 originally resolved.
If the goal is to fail the command directly without retries and without
invoking the EH, would an error status that evaluates to SUCCESS in
scsi_decide_disposition() (such as DID_BAD_TARGET) be more appropriate here?
> + if (ufshcd_is_scsi_cmd(scmd))
> ufshcd_release_scsi_cmd(hba, scmd);
> - } else {
> - set_host_byte(scmd, DID_TIME_OUT);
> - }
> -
> scsi_done(scmd);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1786558726.git.bvanassche@acm.org?part=1
next prev parent reply other threads:[~2026-08-12 18:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 18:22 [PATCH 0/3] ufs: core: Improve error handling Bart Van Assche
2026-08-12 18:22 ` [PATCH 1/3] ufs: core: Simplify timeout handling for START STOP UNIT commands Bart Van Assche
2026-08-12 18:40 ` sashiko-bot [this message]
2026-08-12 18:22 ` [PATCH 2/3] ufs: core: Fix a race condition triggered by ufshcd_eh_timed_out() Bart Van Assche
2026-08-12 18:42 ` sashiko-bot
2026-08-12 18:22 ` [PATCH 3/3] ufs: core: Do not forcibly complete SCSI commands Bart Van Assche
2026-08-12 18:38 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812184015.88A821F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bvanassche@acm.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox