Skip to content

Commit 4b1a2c2

Browse files
gonzoleemanmartinkpetersen
authored andcommitted
scsi: core: Add BLIST_NO_VPD_SIZE for some VDASD
Some storage, such as AIX VDASD (virtual storage) and IBM 2076 (front end), fail as a result of commit c92a6b5 ("scsi: core: Query VPD size before getting full page"). That commit changed getting SCSI VPD pages so that we now read just enough of the page to get the actual page size, then read the whole page in a second read. The problem is that the above mentioned hardware returns zero for the page size, because of a firmware error. In such cases, until the firmware is fixed, this new blacklist flag says to revert to the original method of reading the VPD pages, i.e. try to read a whole buffer's worth on the first try. [mkp: reworked somewhat] Fixes: c92a6b5 ("scsi: core: Query VPD size before getting full page") Reported-by: Martin Wilck <[email protected]> Suggested-by: Hannes Reinecke <[email protected]> Signed-off-by: Lee Duncan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Srikar Dronamraju <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ce756da commit 4b1a2c2

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

drivers/scsi/scsi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ static int scsi_get_vpd_size(struct scsi_device *sdev, u8 page)
326326
unsigned char vpd_header[SCSI_VPD_HEADER_SIZE] __aligned(4);
327327
int result;
328328

329+
if (sdev->no_vpd_size)
330+
return SCSI_DEFAULT_VPD_LEN;
331+
329332
/*
330333
* Fetch the VPD page header to find out how big the page
331334
* is. This is done to prevent problems on legacy devices

drivers/scsi/scsi_devinfo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static struct {
134134
{"3PARdata", "VV", NULL, BLIST_REPORTLUN2},
135135
{"ADAPTEC", "AACRAID", NULL, BLIST_FORCELUN},
136136
{"ADAPTEC", "Adaptec 5400S", NULL, BLIST_FORCELUN},
137-
{"AIX", "VDASD", NULL, BLIST_TRY_VPD_PAGES},
137+
{"AIX", "VDASD", NULL, BLIST_TRY_VPD_PAGES | BLIST_NO_VPD_SIZE},
138138
{"AFT PRO", "-IX CF", "0.0>", BLIST_FORCELUN},
139139
{"BELKIN", "USB 2 HS-CF", "1.95", BLIST_FORCELUN | BLIST_INQUIRY_36},
140140
{"BROWNIE", "1200U3P", NULL, BLIST_NOREPORTLUN},
@@ -188,6 +188,7 @@ static struct {
188188
{"HPE", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES},
189189
{"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN},
190190
{"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
191+
{"IBM", "2076", NULL, BLIST_NO_VPD_SIZE},
191192
{"IBM", "2105", NULL, BLIST_RETRY_HWERROR},
192193
{"iomega", "jaz 1GB", "J.86", BLIST_NOTQ | BLIST_NOLUN},
193194
{"IOMEGA", "ZIP", NULL, BLIST_NOTQ | BLIST_NOLUN},

drivers/scsi/scsi_scan.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
10571057
else if (*bflags & BLIST_SKIP_VPD_PAGES)
10581058
sdev->skip_vpd_pages = 1;
10591059

1060+
if (*bflags & BLIST_NO_VPD_SIZE)
1061+
sdev->no_vpd_size = 1;
1062+
10601063
transport_configure_device(&sdev->sdev_gendev);
10611064

10621065
if (sdev->host->hostt->slave_configure) {

include/scsi/scsi_device.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ struct scsi_device {
145145
const char * model; /* ... after scan; point to static string */
146146
const char * rev; /* ... "nullnullnullnull" before scan */
147147

148+
#define SCSI_DEFAULT_VPD_LEN 255 /* default SCSI VPD page size (max) */
148149
struct scsi_vpd __rcu *vpd_pg0;
149150
struct scsi_vpd __rcu *vpd_pg83;
150151
struct scsi_vpd __rcu *vpd_pg80;
@@ -215,6 +216,7 @@ struct scsi_device {
215216
* creation time */
216217
unsigned ignore_media_change:1; /* Ignore MEDIA CHANGE on resume */
217218
unsigned silence_suspend:1; /* Do not print runtime PM related messages */
219+
unsigned no_vpd_size:1; /* No VPD size reported in header */
218220

219221
unsigned int queue_stopped; /* request queue is quiesced */
220222
bool offline_already; /* Device offline message logged */

include/scsi/scsi_devinfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
#define BLIST_IGN_MEDIA_CHANGE ((__force blist_flags_t)(1ULL << 11))
3333
/* do not do automatic start on add */
3434
#define BLIST_NOSTARTONADD ((__force blist_flags_t)(1ULL << 12))
35-
#define __BLIST_UNUSED_13 ((__force blist_flags_t)(1ULL << 13))
35+
/* do not ask for VPD page size first on some broken targets */
36+
#define BLIST_NO_VPD_SIZE ((__force blist_flags_t)(1ULL << 13))
3637
#define __BLIST_UNUSED_14 ((__force blist_flags_t)(1ULL << 14))
3738
#define __BLIST_UNUSED_15 ((__force blist_flags_t)(1ULL << 15))
3839
#define __BLIST_UNUSED_16 ((__force blist_flags_t)(1ULL << 16))
@@ -74,8 +75,7 @@
7475
#define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \
7576
(__force blist_flags_t) \
7677
((__force __u64)__BLIST_LAST_USED - 1ULL)))
77-
#define __BLIST_UNUSED_MASK (__BLIST_UNUSED_13 | \
78-
__BLIST_UNUSED_14 | \
78+
#define __BLIST_UNUSED_MASK (__BLIST_UNUSED_14 | \
7979
__BLIST_UNUSED_15 | \
8080
__BLIST_UNUSED_16 | \
8181
__BLIST_UNUSED_24 | \

0 commit comments

Comments
 (0)