diff options
| author | Martin K. Petersen (Oracle) <mkp@kernel.org> | 2026-11-08 22:00:43 -0500 |
|---|---|---|
| committer | Martin K. Petersen (Oracle) <mkp@kernel.org> | 2026-11-08 22:00:43 -0500 |
| commit | 0ba0ffc7748d83c6f8792fea31b569042a12f1b2 (patch) | |
| tree | f8e45019cafd4febd28b3c31df96db99f82411f1 /scripts/Makefile.thinlto | |
| parent | e1a17bf98f513a77e5e6903315c49f56ee009886 (diff) | |
| parent | 6054ce4233dbc692f50da5517ad459fae1b14ac6 (diff) | |
| download | linux-next-0ba0ffc7748d83c6f8792fea31b569042a12f1b2.tar.gz linux-next-0ba0ffc7748d83c6f8792fea31b569042a12f1b2.zip | |
Merge patch series "scsi: Bind sd to LUs in the ALUA unavailable state"
Brian Bunker <brian@purestorage.com> says:
A LU that is in the ALUA unavailable state on a target port reports
peripheral qualifier 001b in its INQUIRY data. scsi_bus_match() only
matches devices with peripheral qualifier 000b, so if a host scans such a
path, no upper-level driver is ever bound to it. When the target port later
becomes available, nothing binds sd and the path stays unusable until the
device is deleted and rescanned. A host that was already running when the
path became unavailable keeps sd bound, so the result depends on when the
host scanned.
This series fixes that at scan time. The SCSI core reads the ALUA access
state of a device with REPORT TARGET PORT GROUPS before the device is
registered, and matches sd to PQ 001b devices whose access state could be
read. SPC-4 requires PQ 001b in the unavailable state, and the command
fails for an unmapped LUN, so these are taken to be mapped LUs that are
unavailable. This is the same situation as a path in the standby state, to
which sd already binds. The path then stays in the multipath map as a
failed path, and the existing UNIT ATTENTION handling brings it back when
the target port becomes available.
PQ 001b cannot be matched on its own: an unmapped LUN reports it as well,
and some targets report every possible LUN in REPORT LUNS. Binding sd to
all of those would create disks with no backing LU. An unmapped LUN fails
REPORT TARGET PORT GROUPS, so the access state is what tells the two cases
apart.
1/3 moves submit_rtpg() out of scsi_dh_alua into the SCSI core as
scsi_report_tpgs(), so the core can read the ALUA state of a
device itself. No functional change.
2/3 sends REPORT TARGET PORT GROUPS from scsi_add_lun() for a device
that reports TPGS support and sets sdev->access_state from the
descriptor of the target port group of this path.
3/3 matches PQ 001b devices whose access state could be read, which
are taken to be mapped LUs in the unavailable state.
This is an alternative to the series that refreshes the INQUIRY data and
reprobes the device on rescan ("scsi: Refresh INQUIRY data and reprobe on
rescan", v8 last posted). That series needs a way to update the INQUIRY
data of a live device and to reprobe it. This one does not change the
INQUIRY data after the device is discovered, and has no reprobe, so none of
the locking and ordering issues that came with refreshing it.
The INQUIRY data in sysfs is unchanged by this series. It is read and
created once, when the device is discovered, and keeps the peripheral
qualifier reported at that time like the rest of the INQUIRY data. At any
given time that cached peripheral qualifier can be out of sync with the
device, for example after the target port moves between available and
unavailable. An INQUIRY sent to the device returns the current value, and
the access_state attribute shows the current ALUA state.
This does not make every target work. Today none does: a host that scans
a path while it is unavailable never binds sd to it. With this series a
target that answers sd's probe commands in that state is handled
correctly, and the others are no worse off. What it relies on, and the
known limits:
- SPC-4 requires PQ 001b in the unavailable state and requires REPORT
TARGET PORT GROUPS there. It does not say that PQ 001b is reported
only in that state, so a PQ 001b device whose access state could be
read is taken to be a mapped LU that is unavailable: an unmapped
LUN fails the command.
- The decision is made once, at scan, like the peripheral qualifier
itself. If REPORT TARGET PORT GROUPS fails (other than with UNIT
ATTENTION, which is retried), or the INQUIRY data and VPD page 0x83
do not allow it to be sent, nothing is matched, as before.
- SPC-4 requires neither READ CAPACITY nor, in the unavailable state,
MODE SENSE. sd's probe commands are sent to the target. If a target
rejects them, sd keeps default values, such as a capacity of 0,
until a later revalidate, as it does for a standby path today. If
the path changes state while sd probes, it can also end up with a
mix.
- The ALUA device handler is unchanged and treats a new port group as
active/optimized until it learns the state, so the first regular
I/O to an unavailable path, e.g. the partition table read, can fail
with LOGICAL UNIT NOT ACCESSIBLE, TARGET PORT IN UNAVAILABLE STATE.
A path in the standby state already does the same with TARGET PORT
IN STANDBY STATE.
- The standard INQUIRY data, including the peripheral qualifier and
what sd uses from it, is only read when the device is discovered;
the kernel has no mechanism to refresh it. A rescan, e.g. on the
INQUIRY DATA HAS CHANGED UNIT ATTENTION, reads the VPD pages again
and revalidates sd, but does not read the INQUIRY data again.
Link: https://patch.msgid.link/20261029002531.82824-1-brian@purestorage.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
