• Jan Höppner's avatar
    s390/dasd: Fix faulty ENODEV for RO sysfs attribute · 795c9a51
    Jan Höppner authored
    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: default avatarStefan Haberland <sth@linux.vnet.ibm.com>
    Signed-off-by: default avatarJan Höppner <hoeppner@linux.vnet.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    795c9a51
dasd_devmap.c 40.2 KB