Skip to contentSkip to conversation

scsi: Honor TRY_VPD_PAGES during initial scan

PATCH New Chanakan Moongthin 1 participant 1 message Sep 17 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: Honor TRY_VPD_PAGES during initial scan

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
---
 drivers/scsi/scsi_scan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/scsi_scan.c +1 -2
index 0f0f243c2561..a9264a3acaf1 100644
@@ -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

Signature · 1 line
2.47.3