All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sd: always scan VPD pages if thin provisioning is enabled
@ 2017-01-25  7:26 Hannes Reinecke
  2017-01-25  7:57 ` Johannes Thumshirn
  2017-01-25 10:23 ` Christoph Hellwig
  0 siblings, 2 replies; 9+ messages in thread
From: Hannes Reinecke @ 2017-01-25  7:26 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Hannes Reinecke

For any device with an older SCSI revision we might not
be scanning VPD pages, which results in a wrongly configured
discard mode if thin provisioned is enabled.
According to sbc3 any thin provisioned device (ie devices which
have the LBPME bit set in the output of READ CAPACITY(16)) need
to support VPD pages. So this patch always enables VPD pages
even for older SCSI revisions if thin provisioning is enabled.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/sd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 1fbb1ec..08963b0 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2169,7 +2169,15 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
 		if (buffer[14] & 0x40) /* LBPRZ */
 			sdkp->lbprz = 1;
 
-		sd_config_discard(sdkp, SD_LBP_WS16);
+		/*
+		 * sbc3r36 states:
+		 * The device server in a logical unit the supports
+		 * logical block provisioning management shall support
+		 * the Logical Block Provisioning VPD page.
+		 * So VPD pages should be supported if lbpme is set.
+		 */
+		if (!scsi_device_supports_vpd(sdp))
+			sdp->try_vpd_pages = 1;
 	}
 
 	sdkp->capacity = lba + 1;
-- 
1.8.5.6


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

end of thread, other threads:[~2017-01-26  2:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25  7:26 [PATCH] sd: always scan VPD pages if thin provisioning is enabled Hannes Reinecke
2017-01-25  7:57 ` Johannes Thumshirn
2017-01-25 10:23 ` Christoph Hellwig
2017-01-25 10:38   ` Hannes Reinecke
2017-01-25 14:27     ` Ewan D. Milne
2017-01-25 14:38       ` Hannes Reinecke
2017-01-25 15:38         ` James Bottomley
2017-01-25 16:47           ` Hannes Reinecke
2017-01-26  2:45         ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.