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
commit63e716455c756ccbf5722cf3a7764cfe902a4a14 (patch)
tree0287d60c41904cd6fdf8feb5c8f427d2e841e181
parent29f949ffac4d9651be11e6afc7057caf8b1d02ad (diff)
sd: disable logical block provisioning if 'lbpme' is not set
(bsc#1086095 bsc#1078355). suse-commit: e365f138cb9c9c48b710864a9f37a91b4b93381d
-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 d9c03f894f55..7549d53df485 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -411,6 +411,13 @@ provisioning_mode_store(struct device *dev, struct device_attribute *attr,
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 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]);