diff options
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index d49766f3b940..8e23919c8704 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -742,6 +742,7 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, | |||
742 | const char *buf, size_t count) | 742 | const char *buf, size_t count) |
743 | { | 743 | { |
744 | struct dasd_devmap *devmap; | 744 | struct dasd_devmap *devmap; |
745 | struct dasd_device *device; | ||
745 | int val; | 746 | int val; |
746 | char *endp; | 747 | char *endp; |
747 | 748 | ||
@@ -758,12 +759,14 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, | |||
758 | devmap->features |= DASD_FEATURE_READONLY; | 759 | devmap->features |= DASD_FEATURE_READONLY; |
759 | else | 760 | else |
760 | devmap->features &= ~DASD_FEATURE_READONLY; | 761 | devmap->features &= ~DASD_FEATURE_READONLY; |
761 | if (devmap->device) | 762 | device = devmap->device; |
762 | devmap->device->features = devmap->features; | 763 | if (device) { |
763 | if (devmap->device && devmap->device->block | 764 | device->features = devmap->features; |
764 | && devmap->device->block->gdp) | 765 | val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); |
765 | set_disk_ro(devmap->device->block->gdp, val); | 766 | } |
766 | spin_unlock(&dasd_devmap_lock); | 767 | spin_unlock(&dasd_devmap_lock); |
768 | if (device && device->block && device->block->gdp) | ||
769 | set_disk_ro(device->block->gdp, val); | ||
767 | return count; | 770 | return count; |
768 | } | 771 | } |
769 | 772 | ||