Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Brian Bunker <brian@purestorage.com>
To: Bart Van Assche <bvanassche@acm.org>, 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>,
	krishna.kant@purestorage.com
Subject: Re: [PATCH v8 0/5] scsi: Refresh INQUIRY data and reprobe on rescan
Date: Wed, 21 Oct 2026 10:04:34 -0700	[thread overview]
Message-ID: <20261021170434.8478-1-brian@purestorage.com> (raw)
In-Reply-To: <227b9f93-0dda-448f-a268-05cf4f9b6046@acm.org>

On 10/20/26 3:09 PM, Bart Van Assche wrote:
> This is a big behavior change. I prefer not to unbind disks if PQ
> changes.

OK, no unbinding. v9 will never detach a driver from a bound disk.

> Having taken another look at the cover letter makes me wonder whether
> it is really necessary to refetch standard INQUIRY data and reprobe the
> device when the peripheral qualifier or device type has changed?
> [...] When I was working on active/active SCSI arrays myself we
> didn't care about the INQUIRY data in the kernel and let multipathd
> figure out which path(s) to use.

I'd like multipathd to make that decision too. The problem is a path it
never gets to see. If a host scans while the array reports PQ = 1 on a
path, scsi_bus_match() doesn't bind sd, so the path has no block device
and multipathd doesn't know it exists. When the array returns to
PQ = 0, nothing binds sd, and the path stays unusable until someone
deletes the device and rescans. User space can't fix that; only the
kernel can bind sd.

The array has no choice about PQ = 1 here. SPC-4 5.15.2.4.5 requires it
in the unavailable state:

  a) INQUIRY (the peripheral qualifier (see 6.6.2) shall be set to
     001b);

We discussed this in "The PQ=1 saga" thread Martin started in January
2023. The simplest fix, letting scsi_bus_match() bind at PQ = 1, came
up there, and Martin pointed out that some arrays rely on PQ = 1 to
keep a ULD from binding and that keying off TPGS is probably not
enough. The IBM 2145 case behind 948e922fc446 (since reverted) shows
why: it returns PQ = 1 with PDT 0 for LUNs that aren't mapped. So I'm
not proposing that.

What came out of that thread instead was to reprobe the device when it
leaves the unavailable state. Martin suggested triggering a re-probe on
the transition, and you suggested a rescan when the ALUA state goes
from unavailable or standby to an active state. With unbinding off the
table, that is all v9 needs to do:

  - Only logical units with no driver bound are refreshed. A bound
    disk is left exactly as it is today: no INQUIRY refetch, no
    reprobe.

  - If the refreshed INQUIRY data shows PQ = 0, the driver is bound.
    Nothing is ever unbound.

The trigger has to come from the target, because a LU with no driver
bound gets no commands, so no UNIT ATTENTION or ALUA state change
reaches it. Our arrays make the host rescan when they leave
unavailable, the same way they do when the first volume is mapped to a
host. On iSCSI they send an asynchronous event with REPORTED LUNS DATA
HAS CHANGED, and iscsid writes to the sysfs rescan attribute of every
device on the session, which ends up in scsi_rescan_device(). On FC
they log out the host's initiators, and after the re-login the
transport scans the target. That scan finds the existing scsi_device
and today does nothing with it, so the scan path calls
scsi_rescan_device() for registered devices that have no driver bound.
Bound devices skip it, so the scan cost and the time scan_mutex is held
don't change for them.

That leaves one difference you should know about. While a path is
unavailable, a host that was running when it became unavailable keeps
a bound sd on that path, which ALUA and multipathd treat as a failed
path. A host that scanned while it was unavailable has no sd on it.
Both end up the same once the array returns to PQ = 0.

This makes v9 much smaller than v8: no unbind, no offline handling,
and no INQUIRY update on a device that has a driver bound. The fixes
you and Sashiko found still apply where the code remains
(device_is_registered() before binding, the inquiry_len handling, the
PQ 3 / PDT 1Fh filters, and the structural points).

Martin, does this direction work for you before I write it?

Thanks,

Brian

  reply	other threads:[~2026-10-21 17:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 22:13 [PATCH v8 0/5] scsi: Refresh INQUIRY data and reprobe on rescan Brian Bunker
2026-10-19 22:14 ` [PATCH v8 1/5] scsi: core: Protect INQUIRY sysfs attributes with mutex Brian Bunker
2026-10-19 22:14 ` [PATCH v8 2/5] scsi: core: Add scsi_update_inquiry_data() for updating INQUIRY data Brian Bunker
2026-10-19 22:14 ` [PATCH v8 3/5] scsi: core: Refactor scsi_add_lun() to use scsi_update_inquiry_data() Brian Bunker
2026-10-19 22:14 ` [PATCH v8 4/5] scsi: core: Add device reprobe support to scsi_rescan_device() Brian Bunker
2026-10-19 22:31   ` sashiko-bot
2026-10-19 22:14 ` [PATCH v8 5/5] scsi: core: Handle reprobe for existing devices during SCSI scan Brian Bunker
2026-10-19 22:32   ` sashiko-bot
2026-10-19 22:41 ` [PATCH v8 0/5] scsi: Refresh INQUIRY data and reprobe on rescan Bart Van Assche
2026-10-20 17:17   ` Brian Bunker
2026-10-20 22:09     ` Bart Van Assche
2026-10-21 17:04       ` Brian Bunker [this message]
2026-10-21 10:45     ` Hannes Reinecke
2026-10-21 13:21       ` Bart Van Assche
2026-10-21 18:50       ` Brian Bunker
2026-10-22 11:56         ` Hannes Reinecke
2026-10-22 18:04           ` Brian Bunker
2026-10-23  6:59             ` Hannes Reinecke

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=20261021170434.8478-1-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