Commit 1ed9f752 authored by Jens Axboe's avatar Jens Axboe Committed by Kamal Mostafa

scsi: fix host max depth checking for the 'queue_depth' sysfs interface

commit 1278dd68 upstream.

Commit 1e6f2416 changed the scsi sysfs 'queue_depth' code to
rejects depths higher than the scsi host template setting. But lots
of hosts set this to 1, and update the settings in the scsi host
when the controller/devices probing happens.

This breaks (at least) mpt2sas and mpt3sas runtime setting of queue
depth, returning EINVAL for all settings but '1'. And once it's set to
1, there's no way to go back up.

Fixes: 1e6f2416 "scsi: don't allow setting of queue_depth bigger than can_queue"
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 7c4479ca
...@@ -859,7 +859,7 @@ sdev_store_queue_depth(struct device *dev, struct device_attribute *attr, ...@@ -859,7 +859,7 @@ sdev_store_queue_depth(struct device *dev, struct device_attribute *attr,
depth = simple_strtoul(buf, NULL, 0); depth = simple_strtoul(buf, NULL, 0);
if (depth < 1 || depth > sht->can_queue) if (depth < 1 || depth > sdev->host->can_queue)
return -EINVAL; return -EINVAL;
retval = sht->change_queue_depth(sdev, depth); retval = sht->change_queue_depth(sdev, depth);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment