From: Brian Bunker <brian@purestorage.com>
To: linux-scsi@vger.kernel.org
Cc: "Martin K . Petersen" <mkp@kernel.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
James.Bottomley@HansenPartnership.com,
Hannes Reinecke <hare@suse.de>,
Bart Van Assche <bvanassche@acm.org>,
krishna.kant@purestorage.com,
Brian Bunker <brian@purestorage.com>
Subject: [PATCH v7 5/5] scsi: core: Handle reprobe for existing devices during SCSI scan
Date: Wed, 14 Oct 2026 15:00:14 -0700 [thread overview]
Message-ID: <20261014220014.94330-6-brian@purestorage.com> (raw)
In-Reply-To: <20261014220014.94330-1-brian@purestorage.com>
Complement scsi_rescan_device() reprobe by handling the scan path.
When a manual or transport-initiated scan finds a LUN that already has
a fully set up scsi_device, call scsi_rescan_device() for it so that
changes to the standard INQUIRY data are picked up and the device is
reprobed if its peripheral qualifier or device type changed.
The device lock is taken inside scsi_rescan_device() while the host's
scan_mutex is held; that lock order is already used by
scsi_remove_device(). Pseudo devices and devices that are still being
set up by another scan are left alone.
Co-developed-by: Krishna Kant <krishna.kant@purestorage.com>
Signed-off-by: Krishna Kant <krishna.kant@purestorage.com>
Signed-off-by: Brian Bunker <brian@purestorage.com>
---
drivers/scsi/scsi_scan.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 2c848265c9b9..ea54c9cf9f0b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1154,6 +1154,16 @@ static int scsi_probe_and_add_lun(struct Scsi_Host *shost,
SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
"scsi scan: device exists on %s\n",
dev_name(&sdev->sdev_gendev)));
+ /*
+ * Rescanning a device that has been fully set up:
+ * refresh its INQUIRY data so that peripheral
+ * qualifier or device type changes (e.g. ALUA state
+ * transitions) are picked up.
+ */
+ if (rescan != SCSI_SCAN_INITIAL &&
+ !scsi_device_created(sdev) &&
+ !scsi_device_is_pseudo_dev(sdev))
+ scsi_rescan_device(sdev);
if (sdevp)
*sdevp = sdev;
else
--
2.56.0
prev parent reply other threads:[~2026-10-14 22:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 22:00 [PATCH v7 0/5] scsi: Refresh INQUIRY data and reprobe on rescan Brian Bunker
2026-10-14 22:00 ` [PATCH v7 1/5] scsi: core: Protect INQUIRY sysfs attributes with mutex Brian Bunker
2026-10-14 22:12 ` sashiko-bot
2026-10-14 22:00 ` [PATCH v7 2/5] scsi: core: Add scsi_update_inquiry_data() for updating INQUIRY data Brian Bunker
2026-10-14 22:00 ` [PATCH v7 3/5] scsi: core: Refactor scsi_add_lun() to use scsi_update_inquiry_data() Brian Bunker
2026-10-14 22:00 ` [PATCH v7 4/5] scsi: core: Add device reprobe support to scsi_rescan_device() Brian Bunker
2026-10-14 22:17 ` sashiko-bot
2026-10-14 22:00 ` Brian Bunker [this message]
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=20261014220014.94330-6-brian@purestorage.com \
--to=brian@purestorage.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=krishna.kant@purestorage.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mkp@kernel.org \
/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