From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Hannes Reinecke <hare@suse.com>
Subject: [PATCH] sd: always scan VPD pages if thin provisioning is enabled
Date: Wed, 25 Jan 2017 08:26:05 +0100 [thread overview]
Message-ID: <1485329165-64825-1-git-send-email-hare@suse.de> (raw)
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
next reply other threads:[~2017-01-25 7:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 7:26 Hannes Reinecke [this message]
2017-01-25 7:57 ` [PATCH] sd: always scan VPD pages if thin provisioning is enabled 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485329165-64825-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox