From: Stanley Jhu <stanleyjhu@google.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Stanley Jhu <stanleyjhu@google.com>,
"Martin K. Petersen" <mkp@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@sandisk.com>,
Bean Huo <beanhuo@micron.com>,
Can Guo <can.guo@oss.qualcomm.com>,
Peter Wang <peter.wang@mediatek.com>,
Manivannan Sadhasivam <mani@kernel.org>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] scsi: ufs: core: Release command resources instead of force-completing
Date: Mon, 21 Sep 2026 12:37:55 +0800 [thread overview]
Message-ID: <20260921043755.1689675-1-stanleyjhu@google.com> (raw)
In-Reply-To: <fee250ea-8e0b-4320-880e-8e2627e7b103@acm.org>
On 9/20/26 5:41 PM, Bart Van Assche wrote:
> No, this is not what I suggested.
Sorry about that - the Suggested-by: tag does not belong on this patch
and I will drop it.
> The text above says "implement this in three steps". Hence, this patch
> should have been three patches instead of one because of the "one change
> per patch" rule in the Linux kernel community.
Agreed.
> Why has ufshcd_clear_lu_cmds() been modified? This function is only
> called for pending commands so checking &hba->outstanding_reqs is not
> necessary.
> This is also wrong because this change will trigger a use-after-free in
> scmd_eh_abort_handler() if it decides to retry or finish a SCSI command.
Both hunks are out of scope for this patch and I will drop them.
> Did you read this code before you posted it? As its name suggests,
> ufshcd_release_scsi_cmd() is only called for SCSI commands. No device
> management command code should be added in this function.
You are right. In ufshcd_compl_one_cqe() I moved the
ufshcd_release_scsi_cmd() call out of the ufshcd_is_scsi_cmd() branch,
which let device management commands reach that function, and then
added an early return there to filter them back out. In the respin the
call will stay inside the branch, with no device management handling in
that function.
> Regarding (3), the UFS driver is a SCSI LLD (low-level driver) and hence
> should only do what is specific to the UFS driver. Completing commands
> after .eh_host_reset_handler() has been called is the responsibility of
> the SCSI core and should not be done by the UFS driver.
Agreed for the path where SCSI EH drove the reset. The case I am unsure
about is the other caller: ufshcd_err_handler() also runs from
hba->eh_work, scheduled by ufshcd_check_errors() on UIC and controller
errors. Those commands have not timed out and are not on
shost->eh_cmd_q, so SCSI EH never finishes them, and the handler leaves
them to the reset path on purpose:
/*
* if host reset is required then skip clearing the pending
* transfers forcefully because they will get cleared during
* host reset and restore
*/
Should those simply wait for the block layer timeout and come back
through SCSI EH?
Thanks,
Stanley
next prev parent reply other threads:[~2026-09-21 4:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 14:33 [PATCH 0/2] scsi: ufs: core: Fix SCSI EH command ownership and remove force_compl Stanley Jhu
2026-09-20 14:33 ` [PATCH 1/2] scsi: ufs: core: Release command resources instead of force-completing Stanley Jhu
2026-09-21 0:41 ` Bart Van Assche
2026-09-21 4:37 ` Stanley Jhu [this message]
2026-09-20 14:33 ` [PATCH 2/2] scsi: ufs: core: Remove unused force_compl parameter and MCQ helper Stanley Jhu
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=20260921043755.1689675-1-stanleyjhu@google.com \
--to=stanleyjhu@google.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@sandisk.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=can.guo@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mkp@kernel.org \
--cc=peter.wang@mediatek.com \
/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
all inboxes | Powered by JetHome®