Home Home > GIT Browse > SLE12-SP3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2019-02-14 17:41:20 +0100
committerJean Delvare <jdelvare@suse.de>2019-02-14 17:41:20 +0100
commitcb3c541230d3c9bf67c61a8c8c8c803f08951c36 (patch)
tree737832e2f3b2e8e4c6ba3b67ff2f4fd05d1f4748
parent5147240fd33875c4f1006dac4d1f8251292db55c (diff)
sd: disable logical block provisioning if 'lbpme' is not setSLE12-SP3
(bsc#1086095 bsc#1078355). suse-commit: 96370bd87299c7a6883b3e2bf13818f60c8ba611
-rw-r--r--drivers/scsi/sd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 00edf1d0392f..c24476728bc1 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -415,6 +415,13 @@ provisioning_mode_store(struct device *dev, struct device_attribute *attr,
if (sdp->type != TYPE_DISK)
return -EINVAL;
+ /*
+ * If logical block provisioning isn't enabled we can only
+ * select 'disable' here.
+ */
+ if (!sdkp->lbpme && strncmp(buf, lbp_mode[SD_LBP_DISABLE], 20))
+ return -EINVAL;
+
if (!strncmp(buf, lbp_mode[SD_LBP_UNMAP], 20))
sd_config_discard(sdkp, SD_LBP_UNMAP);
else if (!strncmp(buf, lbp_mode[SD_LBP_WS16], 20))
@@ -2789,8 +2796,10 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
sdkp->max_ws_blocks = (u32)get_unaligned_be64(&buffer[36]);
- if (!sdkp->lbpme)
+ if (!sdkp->lbpme) {
+ sd_config_discard(sdkp, SD_LBP_DISABLE);
goto out;
+ }
lba_count = get_unaligned_be32(&buffer[20]);
desc_count = get_unaligned_be32(&buffer[24]);