[PATCH v8 4/6] scsi: add BLIST_NO_LUN_1F blacklist flag
Phil Pemberton <[email protected]> Fri, 31 Jul 2026 22:35:01 +0100
| Newsgroups | gmane.linux.scsi,gmane.linux.ide,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
Some multi-LUN devices respond to INQUIRY on unpopulated LUNs with PQ=0 / PDT=0x1f instead of the standard PQ=3. The SCSI scan layer normally adds such devices (PQ=0 means "connected"), producing spurious "No Device" entries. The scsi_target field pdt_1f_for_no_lun already exists to suppress this, but was previously only set by the USB UFI driver. Add BLIST_NO_LUN_1F so the flag can be set per-device from scsi_devinfo, and wire it up in scsi_probe_and_add_lun() to set starget->pdt_1f_for_no_lun from the blacklist flags. This is placed immediately before the PDT=0x1f check so it takes effect for all LUNs, including LUN 0, without waiting for scsi_add_lun() to run. Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Signed-off-by: Phil Pemberton <[email protected]> --- drivers/scsi/scsi_scan.c | 3 +++ include/scsi/scsi_devinfo.h | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index e27da038603a..98bd4d49fd62 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1296,6 +1296,9 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, * PDT=00h Direct-access device (floppy) * PDT=1Fh none (no FDD connected to the requested logical unit) */ + if (bflags & BLIST_NO_LUN_1F) + starget->pdt_1f_for_no_lun = 1; + if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) && (result[0] & 0x1f) == 0x1f && !scsi_is_wlun(lun)) { diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h index 1d79a3b536ce..6957b0705510 100644 --- a/include/scsi/scsi_devinfo.h +++ b/include/scsi/scsi_devinfo.h @@ -34,7 +34,8 @@ #define BLIST_NOSTARTONADD ((__force blist_flags_t)(1ULL << 12)) /* do not ask for VPD page size first on some broken targets */ #define BLIST_NO_VPD_SIZE ((__force blist_flags_t)(1ULL << 13)) -#define __BLIST_UNUSED_14 ((__force blist_flags_t)(1ULL << 14)) +/* PDT 0x1f with PQ 0 means no LUN present (e.g. some ATAPI multi-LUN) */ +#define BLIST_NO_LUN_1F ((__force blist_flags_t)(1ULL << 14)) #define __BLIST_UNUSED_15 ((__force blist_flags_t)(1ULL << 15)) #define __BLIST_UNUSED_16 ((__force blist_flags_t)(1ULL << 16)) /* try REPORT_LUNS even for SCSI-2 devs (if HBA supports more than 8 LUNs) */ @@ -77,8 +78,7 @@ #define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \ (__force blist_flags_t) \ ((__force __u64)__BLIST_LAST_USED - 1ULL))) -#define __BLIST_UNUSED_MASK (__BLIST_UNUSED_14 | \ - __BLIST_UNUSED_15 | \ +#define __BLIST_UNUSED_MASK (__BLIST_UNUSED_15 | \ __BLIST_UNUSED_16 | \ __BLIST_UNUSED_24 | \ __BLIST_UNUSED_27 | \ -- 2.43.0