diff options
author | Jan Höppner <hoeppner@linux.vnet.ibm.com> | 2017-06-22 17:17:15 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-06-28 07:32:15 +0200 |
commit | 795c9a5106119f45d2501c4fb01051178904753f (patch) | |
tree | ece078078b134225f127f5edd49e36db738bd402 /drivers/s390/block/dasd_devmap.c | |
parent | 312e8462ab6a1594a0bc4bc51c8e36c9f07b447b (diff) | |
download | linux-stable-795c9a5106119f45d2501c4fb01051178904753f.tar.gz linux-stable-795c9a5106119f45d2501c4fb01051178904753f.tar.bz2 linux-stable-795c9a5106119f45d2501c4fb01051178904753f.zip |
s390/dasd: Fix faulty ENODEV for RO sysfs attribute
If a device is offline it can still be set to read-only via the bus id
through sysfs. Only the read-only feature flag for the ccw_device is
then set. If the device is online the corresponding block device needs
to be set to read-only as well (via set_disk_ro()).
The check whether there is a device to do so, however, happens after the
feature flag was set. This leads to an unnecessary "no such device"
error in the offline case.
This bug was introduced by commit 7571cb1c8e3cc ("s390/dasd: Make use of
dasd_set_feature() more often"). Fix this by simply returning count if
no device is available.
Fixes: 7571cb1c8e3cc ("s390/dasd: Make use of dasd_set_feature() more often")
Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index e943d9c48926..7c7351276d2e 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -786,7 +786,7 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, device = dasd_device_from_cdev(cdev); if (IS_ERR(device)) - return PTR_ERR(device); + return count; spin_lock_irqsave(get_ccwdev_lock(cdev), flags); val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); |