Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2019-02-14 18:55:35 +0100
committerJean Delvare <jdelvare@suse.de>2019-02-14 18:55:35 +0100
commite365f138cb9c9c48b710864a9f37a91b4b93381d (patch)
tree9b0364042de803df91f85eb2f8498bb1ecb82dc3
parentda8955a8cfbac7de855124f12ce06b14f93e7146 (diff)
sd: disable logical block provisioning if 'lbpme' is not set
(bsc#1086095 bsc#1078355).
-rw-r--r--patches.fixes/sd-disable-logical-block-provisioning-if-lbpme-is-no.patch45
-rw-r--r--series.conf1
2 files changed, 46 insertions, 0 deletions
diff --git a/patches.fixes/sd-disable-logical-block-provisioning-if-lbpme-is-no.patch b/patches.fixes/sd-disable-logical-block-provisioning-if-lbpme-is-no.patch
new file mode 100644
index 0000000000..9e158b8b53
--- /dev/null
+++ b/patches.fixes/sd-disable-logical-block-provisioning-if-lbpme-is-no.patch
@@ -0,0 +1,45 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Fri, 20 Apr 2018 15:44:40 +0200
+Subject: [PATCH] sd: disable logical block provisioning if 'lbpme' is not set
+Patch-Mainline: submitted linux-scsi 2018/10/03
+References: bsc#1086095 bsc#1078355
+
+When evaluating the 'block limits' VPD page we need to check if
+the 'lbpme' (logical block provisioning management enable) bit
+is set in the READ CAPACITY (16) output.
+If it isn't we can safely assume that we cannot use DISCARD on
+this device.
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+---
+ drivers/scsi/sd.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -411,6 +411,13 @@ provisioning_mode_store(struct device *d
+ if (mode < 0)
+ return -EINVAL;
+
++ /*
++ * If logical block provisioning isn't enabled we can only
++ * select 'disable' here.
++ */
++ if (!sdkp->lbpme && mode != SD_LBP_DISABLE)
++ return -EINVAL;
++
+ sd_config_discard(sdkp, mode);
+
+ return count;
+@@ -2942,8 +2949,10 @@ static void sd_read_block_limits(struct
+
+ 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]);
diff --git a/series.conf b/series.conf
index 32653d3da5..f5db81f11d 100644
--- a/series.conf
+++ b/series.conf
@@ -20673,6 +20673,7 @@
patches.suse/scsi-sr-workaround-VMware-ESXi-cdrom-emulation-bug.patch
patches.kabi/target-se_dev_attrib.emulate_pr-ABI-stability.patch
+ patches.fixes/sd-disable-logical-block-provisioning-if-lbpme-is-no.patch
########################################################
# DRM/Video