Skip to content

scsi: Support ALUA unavailable state and INQUIRY changes

Brian Bunker linux-scsi 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6scsi: Add INQUIRY data field definitions and accessor helpersinclude/scsi/scsi.h+171 -02 replies
2/6scsi: Protect INQUIRY sysfs attributes with mutexdrivers/scsi/scsi_sysfs.c+67 -730 replies
3/6scsi: Add scsi_update_inquiry_data() for updating INQUIRY datadrivers/scsi/scsi.c include/scsi/scsi_device.h+177 -00 replies
4/6scsi: Refactor scsi_add_lun() to use scsi_update_inquiry_data()drivers/scsi/scsi_scan.c+17 -820 replies
5/6scsi: Add device reprobe support to scsi_rescan_device()drivers/scsi/scsi_scan.c+120 -110 replies
6/6scsi: Handle reprobe for existing devices during SCSI scandrivers/scsi/scsi_scan.c+83 -80 replies

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchHannes ReineckeDamien Le Moal
1/6R-b
2/6R-b R-b R-b R-b R-b
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/6] scsi: Support ALUA unavailable state and INQUIRY changes

The SCSI mid-layer fails to refresh standard INQUIRY data during rescans. This prevents support for the ALUA "unavailable" state, where the Peripheral Qualifier (PQ) toggles between 1 and 0. When a device becomes available, the cached stale PQ prevents upper-layer drivers from attaching.

Additionally, the Unit Attention for "INQUIRY DATA HAS CHANGED" is effectively ignored for identification changes because the rescan does not update standard INQUIRY fields.

Introduce scsi_update_inquiry_data() to refresh the PQ, device type, and identification strings. Use a new inquiry_mutex to protect concurrent sysfs access while the buffer is reallocated.

If a rescan detects a change in PQ or device type, trigger device_reprobe() to automatically match and attach the correct driver.

Fixes added:
- ALUA/UA Fix: Refreshes standard INQUIRY data on rescan.
- Safety: Uses kmemdup and a mutex to prevent Use-After-Free.
- Deadlock Avoidance: Drops device_lock before reprobing.

Brian Bunker (6):
scsi: Add INQUIRY data field definitions and accessor helpers
scsi: Protect INQUIRY sysfs attributes with mutex
scsi: Add scsi_update_inquiry_data() for updating INQUIRY data
scsi: Refactor scsi_add_lun() to use scsi_update_inquiry_data()
scsi: Add device reprobe support to scsi_rescan_device()
scsi: Handle reprobe for existing devices during SCSI scan

 drivers/scsi/scsi.c        | 164 +++++++++++++++++++
 drivers/scsi/scsi_scan.c   | 321 +++++++++++++++++++++++++------------
 drivers/scsi/scsi_sysfs.c  |  74 ++++++++-
 include/scsi/scsi.h        | 171 ++++++++++++++++++++
 include/scsi/scsi_device.h |  13 ++
 5 files changed, 635 insertions(+), 108 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)