Skip to contentSkip to conversation

sd: always scan VPD pages if thin provisioning is enabled

PATCH In review Hannes Reinecke 6 participants 9 messages Jan 25, 2017 – Jan 26, 2017 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sd: always scan VPD pages if thin provisioning is enabled

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.

---
 drivers/scsi/sd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/scsi/sd.c +9 -1
index 1fbb1ec..08963b0 100644
@@ -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;
Signature · 1 line
1.8.5.6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · 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.

---

Looks good,

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#2 lore raw
In reply to Hannes Reinecke
Quoted 7 lines · 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.

Can you explain what you need this for? A device with a per-SBC3 revision that wants us to use UNMAP?

drivers/scsi/sd.c static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2178

Quoted 7 lines
drivers/scsi/sd.c +7 -0
+		/*
+		 * 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.
+		 */

It's a bit odd to quote SBC3 when the device clearly is pre-SBC3 to need this workaround..

drivers/scsi/sd.c static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2180

Quoted 2 lines
drivers/scsi/sd.c +2 -0
+		if (!scsi_device_supports_vpd(sdp))
+			sdp->try_vpd_pages = 1;

Do the assignment unconditionally?

#3 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · 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.

Quoted 3 lines

Can you explain what you need this for? A device with a per-SBC3 revision that wants us to use UNMAP?

Some storage arrays essentially lie about the SCSI revision (most notably Hitachi :-), and some claim to support SPC-2 (or even SPC) but support newer features, too. Most notably VPD pages support. In this case it was an HP EVA claiming to support SPC-2 only, but providing thin provisioning.

Quoted 11 lines

drivers/scsi/sd.c static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2178

Quoted 7 lines
drivers/scsi/sd.c +7 -0
+		/*
+		 * 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.
+		 */

It's a bit odd to quote SBC3 when the device clearly is pre-SBC3 to need this workaround..

_Actually_ it's pre-SPC-3.

But that was the earliest draft I had :-(
I'd be happy to modify this if I had access to sbc-2 drafts.

Quoted 5 lines

drivers/scsi/sd.c static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2180

Quoted 2 lines
drivers/scsi/sd.c +2 -0
+		if (!scsi_device_supports_vpd(sdp))
+			sdp->try_vpd_pages = 1;

Do the assignment unconditionally?

Yeah, can do.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#4 lore raw
Quoted 10 lines · Hannes Reinecke
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · 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.

Quoted 8 lines
Quoted 3 lines

Can you explain what you need this for? A device with a per-SBC3 revision that wants us to use UNMAP?

Some storage arrays essentially lie about the SCSI revision (most notably Hitachi :-), and some claim to support SPC-2 (or even SPC) but support newer features, too. Most notably VPD pages support. In this case it was an HP EVA claiming to support SPC-2 only, but providing thin provisioning.

Um, isn't this why we added:

commit c1d40a527e885a40bb9ea6c46a1b1145d42b66a0

Author: Martin K. Petersen <[email protected]>
Date:   Tue Jul 15 12:49:17 2014 -0400

scsi: add a blacklist flag which enables VPD page inquiries

(well, it was for storvsc, but we could add an entry for the HP EVA)

Quoted 26 lines
Quoted 11 lines

drivers/scsi/sd.c static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2178

Quoted 7 lines
drivers/scsi/sd.c +7 -0
+		/*
+		 * 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.
+		 */

It's a bit odd to quote SBC3 when the device clearly is pre-SBC3 to need this workaround..

_Actually_ it's pre-SPC-3.

But that was the earliest draft I had :-(
I'd be happy to modify this if I had access to sbc-2 drafts.

Quoted 5 lines

drivers/scsi/sd.c static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, · line 2180

Quoted 2 lines
drivers/scsi/sd.c +2 -0
+		if (!scsi_device_supports_vpd(sdp))
+			sdp->try_vpd_pages = 1;

Do the assignment unconditionally?

Yeah, can do.

Cheers,

Hannes

#5 lore raw
Quoted 22 lines · Ewan D. Milne
Quoted 10 lines · Hannes Reinecke
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · 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.

Quoted 8 lines
Quoted 3 lines

Can you explain what you need this for? A device with a per-SBC3 revision that wants us to use UNMAP?

Some storage arrays essentially lie about the SCSI revision (most notably Hitachi :-), and some claim to support SPC-2 (or even SPC) but support newer features, too. Most notably VPD pages support. In this case it was an HP EVA claiming to support SPC-2 only, but providing thin provisioning.

Um, isn't this why we added:

Quoted 8 lines

commit c1d40a527e885a40bb9ea6c46a1b1145d42b66a0

Author: Martin K. Petersen <[email protected]>
Date:   Tue Jul 15 12:49:17 2014 -0400

scsi: add a blacklist flag which enables VPD page inquiries

(well, it was for storvsc, but we could add an entry for the HP EVA)

I knew someone would raise this objection :-)

Thing is, setting 'WS16' here is arguably wrong, as LPBME just means 'logical block provisioning management enabled', not 'WRITE SAME 16 with UNMAP' supported.

And we've set the restriction for scanning VPD pages rather high by moving it to at least SPC-3; meaning we lose out on all SPC-2 devices with logical block provisioning.

So rather than blacklisting each and every device (and incurring loads of customer calls) I'd rather fix it once and for all.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
maintainer
#6 lore raw
Quoted 40 lines · Hannes Reinecke
Quoted 24 lines · Ewan D. Milne
Quoted 12 lines · Hannes Reinecke
Quoted 11 lines · Christoph Hellwig
Quoted 8 lines · 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.

Quoted 8 lines
Quoted 3 lines

Can you explain what you need this for? A device with a per -SBC3 revision that wants us to use UNMAP?

Some storage arrays essentially lie about the SCSI revision (most notably Hitachi :-), and some claim to support SPC-2 (or even SPC) but support newer features, too. Most notably VPD pages support. In this case it was an HP EVA claiming to support SPC-2 only, but providing thin provisioning.

Um, isn't this why we added:

Quoted 9 lines

commit c1d40a527e885a40bb9ea6c46a1b1145d42b66a0

Author: Martin K. Petersen <[email protected]>
Date:   Tue Jul 15 12:49:17 2014 -0400

scsi: add a blacklist flag which enables VPD page inquiries

(well, it was for storvsc, but we could add an entry for the HP EVA)

I knew someone would raise this objection :-)

Thing is, setting 'WS16' here is arguably wrong, as LPBME just means 'logical block provisioning management enabled', not 'WRITE SAME 16 with UNMAP' supported.

Quoted 6 lines

And we've set the restriction for scanning VPD pages rather high by moving it to at least SPC-3; meaning we lose out on all SPC-2 devices with logical block provisioning.

So rather than blacklisting each and every device (and incurring loads of customer calls) I'd rather fix it once and for all.

Anything with a capacity over 2TB gets into RC16 .,. that includes a lot of USB storage nowadays. What would this proposed addition do to them?

James

#7 lore raw
Quoted 45 lines · James Bottomley
Quoted 44 lines · Hannes Reinecke
Quoted 24 lines · Ewan D. Milne
Quoted 12 lines · Hannes Reinecke
Quoted 11 lines · Christoph Hellwig
Quoted 8 lines · 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.

Quoted 8 lines
Quoted 3 lines

Can you explain what you need this for? A device with a per -SBC3 revision that wants us to use UNMAP?

Some storage arrays essentially lie about the SCSI revision (most notably Hitachi :-), and some claim to support SPC-2 (or even SPC) but support newer features, too. Most notably VPD pages support. In this case it was an HP EVA claiming to support SPC-2 only, but providing thin provisioning.

Um, isn't this why we added:

Quoted 9 lines

commit c1d40a527e885a40bb9ea6c46a1b1145d42b66a0

Author: Martin K. Petersen <[email protected]>
Date:   Tue Jul 15 12:49:17 2014 -0400

scsi: add a blacklist flag which enables VPD page inquiries

(well, it was for storvsc, but we could add an entry for the HP EVA)

I knew someone would raise this objection :-)

Thing is, setting 'WS16' here is arguably wrong, as LPBME just means 'logical block provisioning management enabled', not 'WRITE SAME 16 with UNMAP' supported.

And we've set the restriction for scanning VPD pages rather high by moving it to at least SPC-3; meaning we lose out on all SPC-2 devices with logical block provisioning.

Quoted 7 lines
Quoted 2 lines

So rather than blacklisting each and every device (and incurring loads of customer calls) I'd rather fix it once and for all.

Anything with a capacity over 2TB gets into RC16 .,. that includes a lot of USB storage nowadays. What would this proposed addition do to them?

Nothing.
We're latching off the 'LPBME' bit from the READ CAPACITY 16 information, which (hopefully) isn't set. And the 'skip_vpd_pages' as being set by the USB drives is evaluated at a later point, so they won't be affected.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
#8 lore raw
In reply to Hannes Reinecke
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes,

Hannes> Thing is, setting 'WS16' here is arguably wrong, as LPBME just Hannes> means 'logical block provisioning management enabled', not Hannes> 'WRITE SAME 16 with UNMAP' supported.

Things are the way they are because many devices predate the final SBC spec. They report LBPME=1 but do not have the VPD page indicating their preferred deprovisioning command. The VPD was added very late in the spec and there are a ton of devices that don't have it. As a result, we default to WS16 unless the device reports the UNMAP parameters in the Block Limits VPD.

That has been a very solid heuristic for a long time so please don't mess with that.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering