Skip to content

Commit c1d40a5

Browse files
martinkpetersenChristoph Hellwig
authored andcommitted
scsi: add a blacklist flag which enables VPD page inquiries
Despite supporting modern SCSI features some storage devices continue to claim conformance to an older version of the SPC spec. This is done for compatibility with legacy operating systems. Linux by default will not attempt to read VPD pages on devices that claim SPC-2 or older. Introduce a blacklist flag that can be used to trigger VPD page inquiries on devices that are known to support them. Reported-by: KY Srinivasan <kys@microsoft.com> Tested-by: KY Srinivasan <kys@microsoft.com> Reviewed-by: KY Srinivasan <kys@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> CC: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent fd2eb90 commit c1d40a5

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

drivers/scsi/scsi_scan.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
928928

929929
sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT;
930930

931-
if (*bflags & BLIST_SKIP_VPD_PAGES)
931+
if (*bflags & BLIST_TRY_VPD_PAGES)
932+
sdev->try_vpd_pages = 1;
933+
else if (*bflags & BLIST_SKIP_VPD_PAGES)
932934
sdev->skip_vpd_pages = 1;
933935

934936
transport_configure_device(&sdev->sdev_gendev);

drivers/scsi/sd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,6 +2726,11 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer)
27262726

27272727
static int sd_try_extended_inquiry(struct scsi_device *sdp)
27282728
{
2729+
/* Attempt VPD inquiry if the device blacklist explicitly calls
2730+
* for it.
2731+
*/
2732+
if (sdp->try_vpd_pages)
2733+
return 1;
27292734
/*
27302735
* Although VPD inquiries can go to SCSI-2 type devices,
27312736
* some USB ones crash on receiving them, and the pages

include/scsi/scsi_device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ struct scsi_device {
154154
unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */
155155
unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */
156156
unsigned skip_vpd_pages:1; /* do not read VPD pages */
157+
unsigned try_vpd_pages:1; /* attempt to read VPD pages */
157158
unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
158159
unsigned no_start_on_add:1; /* do not issue start on add */
159160
unsigned allow_restart:1; /* issue START_UNIT in error handler */

include/scsi/scsi_devinfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@
3434
#define BLIST_SKIP_VPD_PAGES 0x4000000 /* Ignore SBC-3 VPD pages */
3535
#define BLIST_SCSI3LUN 0x8000000 /* Scan more than 256 LUNs
3636
for sequential scan */
37+
#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */
3738
#endif

0 commit comments

Comments
 (0)