Commit 3f67a059 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: fix endless loop when syncing an array that doesn't need any resync.

If the resync checkpoint for an array is at the end of the array, It doesn't
get set to MAX_SECTOR, so resyncing will be retried.  By updating curr_resync
early, this problem is fixed.
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 31647d19
...@@ -3369,10 +3369,12 @@ static void md_do_sync(mddev_t *mddev) ...@@ -3369,10 +3369,12 @@ static void md_do_sync(mddev_t *mddev)
init_waitqueue_head(&mddev->recovery_wait); init_waitqueue_head(&mddev->recovery_wait);
last_check = 0; last_check = 0;
if (j) if (j>2) {
printk(KERN_INFO printk(KERN_INFO
"md: resuming recovery of %s from checkpoint.\n", "md: resuming recovery of %s from checkpoint.\n",
mdname(mddev)); mdname(mddev));
mddev->curr_resync = j;
}
while (j < max_sectors) { while (j < max_sectors) {
int sectors; int sectors;
...@@ -3454,7 +3456,7 @@ static void md_do_sync(mddev_t *mddev) ...@@ -3454,7 +3456,7 @@ static void md_do_sync(mddev_t *mddev)
if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) &&
mddev->curr_resync > 2 && mddev->curr_resync > 2 &&
mddev->curr_resync > mddev->recovery_cp) { mddev->curr_resync >= mddev->recovery_cp) {
if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
printk(KERN_INFO printk(KERN_INFO
"md: checkpointing recovery of %s.\n", "md: checkpointing recovery of %s.\n",
......
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