linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] sd: Sanity check the optimal I/O size
@ 2015-06-23 16:22 Martin K. Petersen
  2015-06-23 16:22 ` [PATCH 2/2] scsi: Remove VPD quirk for Seagate drives Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Martin K. Petersen @ 2015-06-23 16:22 UTC (permalink / raw)
  To: linux-scsi; +Cc: Martin K. Petersen, stable

We have come across a couple of devices that report unreasonable values
in the optimal I/O size in the Block Limits VPD page. Since this is a
32-bit entity that gets multiplied by the logical block size we can get
disproportionately large values reported to the block layer.

Cap io_opt at 256 MB.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reported-by: Chris Friesen <chris.friesen@windriver.com>
Cc: stable@vger.kernel.org
---
 drivers/scsi/sd.c | 3 ++-
 drivers/scsi/sd.h | 9 +++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a20da8c25b4f..118b336e0ddf 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2560,7 +2560,8 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
 	blk_queue_io_min(sdkp->disk->queue,
 			 get_unaligned_be16(&buffer[6]) * sector_sz);
 	blk_queue_io_opt(sdkp->disk->queue,
-			 get_unaligned_be32(&buffer[12]) * sector_sz);
+			 min_t(unsigned int, SD_MAX_IO_OPT_BYTES,
+			       get_unaligned_be32(&buffer[12]) * sector_sz));
 
 	if (buffer[3] == 0x3c) {
 		unsigned int lba_count, desc_count;
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 63ba5ca7f9a1..f175a3f2944a 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -44,10 +44,11 @@ enum {
 };
 
 enum {
-	SD_DEF_XFER_BLOCKS = 0xffff,
-	SD_MAX_XFER_BLOCKS = 0xffffffff,
-	SD_MAX_WS10_BLOCKS = 0xffff,
-	SD_MAX_WS16_BLOCKS = 0x7fffff,
+	SD_DEF_XFER_BLOCKS	= 0xffff,
+	SD_MAX_XFER_BLOCKS	= 0xffffffff,
+	SD_MAX_WS10_BLOCKS	= 0xffff,
+	SD_MAX_WS16_BLOCKS	= 0x7fffff,
+	SD_MAX_IO_OPT_BYTES	= 256 * 1024 * 1024,
 };
 
 enum {
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] scsi: Remove VPD quirk for Seagate drives
  2015-06-23 16:22 [PATCH 1/2] sd: Sanity check the optimal I/O size Martin K. Petersen
@ 2015-06-23 16:22 ` Martin K. Petersen
  0 siblings, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2015-06-23 16:22 UTC (permalink / raw)
  To: linux-scsi; +Cc: Martin K. Petersen, stable

Now that we sanity check the optimal I/O size reported by the device we
no longer need to blacklist the VPD pages on certain Seagate drives.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: stable@vger.kernel.org
---
 drivers/scsi/scsi_devinfo.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 9f77d23239a2..f04f1b672962 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -232,7 +232,6 @@ static struct {
 	{"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
 	{"SEAGATE", "ST34555N", "0930", BLIST_NOTQ},	/* Chokes on tagged INQUIRY */
 	{"SEAGATE", "ST3390N", "9546", BLIST_NOTQ},
-	{"SEAGATE", "ST900MM0006", NULL, BLIST_SKIP_VPD_PAGES},
 	{"SGI", "RAID3", "*", BLIST_SPARSELUN},
 	{"SGI", "RAID5", "*", BLIST_SPARSELUN},
 	{"SGI", "TP9100", "*", BLIST_REPORTLUN2},
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 1/2] sd: Sanity check the optimal I/O size
@ 2015-06-26 12:58 Tom Yan
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Yan @ 2015-06-26 12:58 UTC (permalink / raw)
  To: linux-scsi

Would it be better to only report when the value is smaller than
256MiB instead of "capping" it?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-26 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 16:22 [PATCH 1/2] sd: Sanity check the optimal I/O size Martin K. Petersen
2015-06-23 16:22 ` [PATCH 2/2] scsi: Remove VPD quirk for Seagate drives Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2015-06-26 12:58 [PATCH 1/2] sd: Sanity check the optimal I/O size Tom Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).