From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, John Garry <john.g.garry@oracle.com>,
Bart Van Assche <bvanassche@acm.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
Peter Wang <peter.wang@mediatek.com>,
Avri Altman <avri.altman@sandisk.com>,
Bean Huo <beanhuo@micron.com>,
Adrian Hunter <adrian.hunter@intel.com>,
"Bao D. Nguyen" <quic_nguyenb@quicinc.com>
Subject: [PATCH v2 1/2] ufs: core: Only call scsi_host_busy() after the SCSI host has been added
Date: Fri, 9 Jan 2026 12:51:01 -0800 [thread overview]
Message-ID: <20260109205104.496478-2-bvanassche@acm.org> (raw)
In-Reply-To: <20260109205104.496478-1-bvanassche@acm.org>
scsi_host_busy() iterates over the host tag set. The host tag set is
initialized by scsi_mq_setup_tags(). The latter function is called by
scsi_add_host(). Hence only call scsi_host_busy() after the SCSI host
has been added. This patch prepares for reverting commit a0b7780602b1
("scsi: core: Fix a regression triggered by scsi_host_busy()").
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/ufs/core/ufshcd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 562d8cffc6f6..69630677b23f 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -283,7 +283,8 @@ static bool ufshcd_has_pending_tasks(struct ufs_hba *hba)
static bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba)
{
- return scsi_host_busy(hba->host) || ufshcd_has_pending_tasks(hba);
+ return (hba->scsi_host_added && scsi_host_busy(hba->host)) ||
+ ufshcd_has_pending_tasks(hba);
}
static const struct ufs_dev_quirk ufs_fixups[] = {
@@ -678,7 +679,8 @@ static void ufshcd_print_host_state(struct ufs_hba *hba)
dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
dev_err(hba->dev, "%d outstanding reqs, tasks=0x%lx\n",
- scsi_host_busy(hba->host), hba->outstanding_tasks);
+ hba->scsi_host_added ? scsi_host_busy(hba->host) : 0,
+ hba->outstanding_tasks);
dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n",
hba->saved_err, hba->saved_uic_err);
dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n",
next prev parent reply other threads:[~2026-01-09 20:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 20:51 [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Bart Van Assche
2026-01-09 20:51 ` Bart Van Assche [this message]
2026-01-13 7:25 ` [PATCH v2 1/2] ufs: core: Only call " Peter Wang (王信友)
2026-01-09 20:51 ` [PATCH v2 2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()" Bart Van Assche
2026-01-10 8:01 ` John Garry
2026-01-12 3:08 ` [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Martin K. Petersen
2026-01-17 4:36 ` Martin K. Petersen
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=20260109205104.496478-2-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=adrian.hunter@intel.com \
--cc=avri.altman@sandisk.com \
--cc=beanhuo@micron.com \
--cc=john.g.garry@oracle.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
--cc=quic_nguyenb@quicinc.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