diff options
author | NeilBrown <neilb@suse.de> | 2013-02-27 19:59:03 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-02-27 19:59:03 -0500 |
commit | f3378b48705154b9089affb2d2e939622aea68f1 (patch) | |
tree | c86f47335ba1bd4fea0dfeb56b0484cebec8dc9b /drivers/md | |
parent | 51acbcec6c42b24482bac18e42befc822524535d (diff) |
md: expedite metadata update when switching read-auto -> active
If something has failed while the array was read-auto,
then when we switch to 'active' we need to update the metadata.
This will happen anyway but it is good to expedite it, and
also to ensure any failed device has been released by the
underlying device before we try to action the ioctl which
caused us to switch to 'active' mode.
Reported-by: Joe Lawrence <Joe.Lawrence@stratus.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index f363135144f6..fcb878f88796 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -6532,7 +6532,17 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, | |||
6532 | mddev->ro = 0; | 6532 | mddev->ro = 0; |
6533 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 6533 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
6534 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 6534 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
6535 | md_wakeup_thread(mddev->thread); | 6535 | /* mddev_unlock will wake thread */ |
6536 | /* If a device failed while we were read-only, we | ||
6537 | * need to make sure the metadata is updated now. | ||
6538 | */ | ||
6539 | if (test_bit(MD_CHANGE_DEVS, &mddev->flags)) { | ||
6540 | mddev_unlock(mddev); | ||
6541 | wait_event(mddev->sb_wait, | ||
6542 | !test_bit(MD_CHANGE_DEVS, &mddev->flags) && | ||
6543 | !test_bit(MD_CHANGE_PENDING, &mddev->flags)); | ||
6544 | mddev_lock(mddev); | ||
6545 | } | ||
6536 | } else { | 6546 | } else { |
6537 | err = -EROFS; | 6547 | err = -EROFS; |
6538 | goto abort_unlock; | 6548 | goto abort_unlock; |