From: NeilBrown Date: Wed, 24 Apr 2013 01:42:41 +0000 (+1000) Subject: md: HOT_DISK_REMOVE shouldn't make a read-auto device active. X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=3ea8929da3e61b54d4adcab1bf9a0034648d578e;p=~shefty%2Frdma-dev.git md: HOT_DISK_REMOVE shouldn't make a read-auto device active. If a fail device or a spare is removed from an array, there is not need to make the array 'active'. If/when the array does become active for some other reason the metadata will be update to reflect the removal. If that never happens and the array is stopped while still read-auto, then there is no loss in forgetting the that the device had 'failed'. A read-only array will leave failed devices attached to the array personality, so we need to explicitly call remove_and_add_spares() to free it (clearing Blocked just like we do in store_slot()). Signed-off-by: NeilBrown --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 07f207e53ba..802c2a379d8 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5883,6 +5883,9 @@ static int hot_remove_disk(struct mddev * mddev, dev_t dev) if (!rdev) return -ENXIO; + clear_bit(Blocked, &rdev->flags); + remove_and_add_spares(mddev, rdev); + if (rdev->raid_disk >= 0) goto busy; @@ -6496,6 +6499,10 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, err = md_set_readonly(mddev, bdev); goto done_unlock; + case HOT_REMOVE_DISK: + err = hot_remove_disk(mddev, new_decode_dev(arg)); + goto done_unlock; + case BLKROSET: if (get_user(ro, (int __user *)(arg))) { err = -EFAULT; @@ -6566,10 +6573,6 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, goto done_unlock; } - case HOT_REMOVE_DISK: - err = hot_remove_disk(mddev, new_decode_dev(arg)); - goto done_unlock; - case HOT_ADD_DISK: err = hot_add_disk(mddev, new_decode_dev(arg)); goto done_unlock;