From: NeilBrown <neilb@suse.de>
Date: Wed, 30 Dec 2009 04:25:23 +0000 (+1100)
Subject: md: allow a resync that is waiting for other resync to complete, to be aborted.
X-Git-Tag: firefly_0821_release~9833^2~3518^2
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=404e4b43fdd6daa7b4a9f81bc7e4358281d763fa;p=firefly-linux-kernel-4.4.55.git

md: allow a resync that is waiting for other resync to complete, to be aborted.

If two arrays share a device, then they will not both resync at the
same time.  One will wait for the other to complete.
While waiting, the MD_RECOVERY_INTR flag is not checked so a device
failure, which would make the resync pointless, does not cause the
resync to abort, so the failed device cannot be removed (as it cannot
be remove while a resync is happening).

So add a test for MD_RECOVERY_INTR.

Reported-by: Brett Russ <bruss@netezza.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---

diff --git a/drivers/md/md.c b/drivers/md/md.c
index c4bdf0601757..dd3dfe42d5a9 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6473,10 +6473,11 @@ void md_do_sync(mddev_t *mddev)
 		mddev->curr_resync = 2;
 
 	try_again:
-		if (kthread_should_stop()) {
+		if (kthread_should_stop())
 			set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+
+		if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
 			goto skip;
-		}
 		for_each_mddev(mddev2, tmp) {
 			if (mddev2 == mddev)
 				continue;