Commit d3351f49 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Avoid hang when multiple raids on shared drives are trying to sync.

I think this is finally right:
 - we always wake_up when curr_resync decreases.
 - we wait for the other guys curr_resync to be less than ours
 - if we ever wait for someone who might yield, we start checking
   again from the start.
parent 591249aa
......@@ -2838,16 +2838,18 @@ static void md_do_sync(void *data)
mdidx(mddev), mdidx(mddev2));
if (mddev < mddev2) {/* arbitrarily yield */
mddev->curr_resync = 1;
yield();
wake_up(&resync_wait);
}
if (wait_event_interruptible(resync_wait,
mddev2->curr_resync < 2)) {
mddev2->curr_resync < mddev->curr_resync)) {
flush_curr_signals();
err = -EINTR;
mddev_put(mddev2);
goto skip;
}
}
if (mddev->curr_resync == 1)
break;
}
} while (mddev->curr_resync < 2);
......
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