]>
Commit | Line | Data |
---|---|---|
033b5a72 GKH |
1 | From c1d40a527e885a40bb9ea6c46a1b1145d42b66a0 Mon Sep 17 00:00:00 2001 |
2 | From: "Martin K. Petersen" <martin.petersen@oracle.com> | |
3 | Date: Tue, 15 Jul 2014 12:49:17 -0400 | |
4 | Subject: scsi: add a blacklist flag which enables VPD page inquiries | |
5 | ||
6 | From: "Martin K. Petersen" <martin.petersen@oracle.com> | |
7 | ||
8 | commit c1d40a527e885a40bb9ea6c46a1b1145d42b66a0 upstream. | |
9 | ||
10 | Despite supporting modern SCSI features some storage devices continue to | |
11 | claim conformance to an older version of the SPC spec. This is done for | |
12 | compatibility with legacy operating systems. | |
13 | ||
14 | Linux by default will not attempt to read VPD pages on devices that | |
15 | claim SPC-2 or older. Introduce a blacklist flag that can be used to | |
16 | trigger VPD page inquiries on devices that are known to support them. | |
17 | ||
18 | Reported-by: KY Srinivasan <kys@microsoft.com> | |
19 | Tested-by: KY Srinivasan <kys@microsoft.com> | |
20 | Reviewed-by: KY Srinivasan <kys@microsoft.com> | |
21 | Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> | |
22 | Signed-off-by: Christoph Hellwig <hch@lst.de> | |
23 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
24 | ||
25 | --- | |
26 | drivers/scsi/scsi_scan.c | 4 +++- | |
27 | drivers/scsi/sd.c | 5 +++++ | |
28 | include/scsi/scsi_device.h | 1 + | |
29 | include/scsi/scsi_devinfo.h | 1 + | |
30 | 4 files changed, 10 insertions(+), 1 deletion(-) | |
31 | ||
32 | --- a/drivers/scsi/scsi_scan.c | |
33 | +++ b/drivers/scsi/scsi_scan.c | |
34 | @@ -950,7 +950,9 @@ static int scsi_add_lun(struct scsi_devi | |
35 | ||
36 | sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT; | |
37 | ||
38 | - if (*bflags & BLIST_SKIP_VPD_PAGES) | |
39 | + if (*bflags & BLIST_TRY_VPD_PAGES) | |
40 | + sdev->try_vpd_pages = 1; | |
41 | + else if (*bflags & BLIST_SKIP_VPD_PAGES) | |
42 | sdev->skip_vpd_pages = 1; | |
43 | ||
44 | transport_configure_device(&sdev->sdev_gendev); | |
45 | --- a/drivers/scsi/sd.c | |
46 | +++ b/drivers/scsi/sd.c | |
47 | @@ -2681,6 +2681,11 @@ static void sd_read_write_same(struct sc | |
48 | ||
49 | static int sd_try_extended_inquiry(struct scsi_device *sdp) | |
50 | { | |
51 | + /* Attempt VPD inquiry if the device blacklist explicitly calls | |
52 | + * for it. | |
53 | + */ | |
54 | + if (sdp->try_vpd_pages) | |
55 | + return 1; | |
56 | /* | |
57 | * Although VPD inquiries can go to SCSI-2 type devices, | |
58 | * some USB ones crash on receiving them, and the pages | |
59 | --- a/include/scsi/scsi_device.h | |
60 | +++ b/include/scsi/scsi_device.h | |
61 | @@ -155,6 +155,7 @@ struct scsi_device { | |
62 | unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ | |
63 | unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ | |
64 | unsigned skip_vpd_pages:1; /* do not read VPD pages */ | |
65 | + unsigned try_vpd_pages:1; /* attempt to read VPD pages */ | |
66 | unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ | |
67 | unsigned no_start_on_add:1; /* do not issue start on add */ | |
68 | unsigned allow_restart:1; /* issue START_UNIT in error handler */ | |
69 | --- a/include/scsi/scsi_devinfo.h | |
70 | +++ b/include/scsi/scsi_devinfo.h | |
71 | @@ -34,4 +34,5 @@ | |
72 | #define BLIST_SKIP_VPD_PAGES 0x4000000 /* Ignore SBC-3 VPD pages */ | |
73 | #define BLIST_SCSI3LUN 0x8000000 /* Scan more than 256 LUNs | |
74 | for sequential scan */ | |
75 | +#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */ | |
76 | #endif |