aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-08-05 01:54:13 -0400
committerNeilBrown <neilb@suse.de>2008-08-05 01:56:32 -0400
commitc89a8eee61540df04fc83f32f51ef0f46ec018b1 (patch)
tree7bffba40357f654de8ed31bc6a0e7468daa61234 /drivers/md/md.c
parentac4090d24c6a26211bc4523d920376e054d4f3f8 (diff)
Allow faulty devices to be removed from a readonly array.
Removing faulty devices from an array is a two stage process. First the device is moved from being a part of the active array to being similar to a spare device. Then it can be removed by a request from user space. The first step is currently not performed for read-only arrays, so the second step can never succeed. So allow readonly arrays to remove failed devices (which aren't blocked). Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 6eb95451f161..25b893ec562e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6003,7 +6003,7 @@ static int remove_and_add_spares(mddev_t *mddev)
6003 } 6003 }
6004 } 6004 }
6005 6005
6006 if (mddev->degraded) { 6006 if (mddev->degraded && ! mddev->ro) {
6007 rdev_for_each(rdev, rtmp, mddev) { 6007 rdev_for_each(rdev, rtmp, mddev) {
6008 if (rdev->raid_disk >= 0 && 6008 if (rdev->raid_disk >= 0 &&
6009 !test_bit(In_sync, &rdev->flags) && 6009 !test_bit(In_sync, &rdev->flags) &&
@@ -6077,6 +6077,8 @@ void md_check_recovery(mddev_t *mddev)
6077 flush_signals(current); 6077 flush_signals(current);
6078 } 6078 }
6079 6079
6080 if (mddev->ro && !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))
6081 return;
6080 if ( ! ( 6082 if ( ! (
6081 (mddev->flags && !mddev->external) || 6083 (mddev->flags && !mddev->external) ||
6082 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || 6084 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) ||
@@ -6090,6 +6092,15 @@ void md_check_recovery(mddev_t *mddev)
6090 if (mddev_trylock(mddev)) { 6092 if (mddev_trylock(mddev)) {
6091 int spares = 0; 6093 int spares = 0;
6092 6094
6095 if (mddev->ro) {
6096 /* Only thing we do on a ro array is remove
6097 * failed devices.
6098 */
6099 remove_and_add_spares(mddev);
6100 clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
6101 goto unlock;
6102 }
6103
6093 if (!mddev->external) { 6104 if (!mddev->external) {
6094 int did_change = 0; 6105 int did_change = 0;
6095 spin_lock_irq(&mddev->write_lock); 6106 spin_lock_irq(&mddev->write_lock);