Commit 87d0aa2f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] md: Make sure md recovery happens appropriately.

From: NeilBrown <neilb@cse.unsw.edu.au>

Currently if there are two failed drives, and two spares are added, then
recovery starts onto the first spare, but never notices the second spare.  To
cope, we set RECOVERY_NEEDED when recovery finishes so that we re-check.
parent 3e4cd40f
...@@ -3376,9 +3376,11 @@ void md_check_recovery(mddev_t *mddev) ...@@ -3376,9 +3376,11 @@ void md_check_recovery(mddev_t *mddev)
if (mddev->sb_dirty) if (mddev->sb_dirty)
md_update_sb(mddev); md_update_sb(mddev);
if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) &&
!test_bit(MD_RECOVERY_DONE, &mddev->recovery)) !test_bit(MD_RECOVERY_DONE, &mddev->recovery)) {
/* resync/recovery still happening */ /* resync/recovery still happening */
clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
goto unlock; goto unlock;
}
if (mddev->sync_thread) { if (mddev->sync_thread) {
/* resync has finished, collect result */ /* resync has finished, collect result */
md_unregister_thread(mddev->sync_thread); md_unregister_thread(mddev->sync_thread);
...@@ -3391,11 +3393,13 @@ void md_check_recovery(mddev_t *mddev) ...@@ -3391,11 +3393,13 @@ void md_check_recovery(mddev_t *mddev)
} }
md_update_sb(mddev); md_update_sb(mddev);
mddev->recovery = 0; mddev->recovery = 0;
/* flag recovery needed just to double check */
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
wake_up(&resync_wait); wake_up(&resync_wait);
goto unlock; goto unlock;
} }
if (mddev->recovery) { if (mddev->recovery) {
/* that's odd.. */ /* probably just the RECOVERY_NEEDED flag */
mddev->recovery = 0; mddev->recovery = 0;
wake_up(&resync_wait); wake_up(&resync_wait);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment