[PATCH] scsi: Honor TRY_VPD_PAGES during initial scan
From: Chanakan Moongthin
Date: Thu Sep 17 2026 - 19:23:37 EST
The scsi_device_supports_vpd() helper treats try_vpd_pages as an
explicit override for the device SCSI level. However, scsi_add_lun()
only calls scsi_attach_vpd() when the reported SCSI level is at least
SCSI_3.
This prevents VPD pages from being cached during initial discovery for
devices that report SCSI-2 but are explicitly flagged with
TRY_VPD_PAGES. The sd driver then cannot read the cached Block Device
Characteristics VPD page, leaving such disks marked rotational until a
manual SCSI rescan.
Call scsi_attach_vpd() unconditionally from scsi_add_lun(). The existing
scsi_device_supports_vpd() check remains responsible for deciding whether
VPD pages may be queried.
On a VMware PVSCSI guest with
scsi_mod.default_dev_flags=0x10000000, the baseline kernel reported
rotational=1 at boot and changed to rotational=0 after rescan. With this
change, rotational=0 was reported during initial discovery.
Fixes: 7fb019c46eee ("scsi: sd: Switch to using scsi_device VPD pages")
Assisted-by: LLM
Signed-off-by: Chanakan Moongthin <me@xxxxxxxxxxxxxxxx>
---
drivers/scsi/scsi_scan.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 0f0f243c2561..a9264a3acaf1 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1122,8 +1122,7 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
if (hostt->sdev_configure)
scsi_realloc_sdev_budget_map(sdev, sdev->queue_depth);
- if (sdev->scsi_level >= SCSI_3)
- scsi_attach_vpd(sdev);
+ scsi_attach_vpd(sdev);
scsi_cdl_check(sdev);
base-commit: 238650ef6c7c7cca08e032527329424c9fbd70e5
--
2.47.3