diff options
author | NeilBrown <neilb@suse.de> | 2013-11-18 20:02:01 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-11-18 23:19:17 -0500 |
commit | c91abf5a3546a4ff0838d2905f4d7eae2795f724 (patch) | |
tree | 39b3735cebfa73ff370f2738bd8578a113fe4215 /drivers/md/raid10.c | |
parent | 29f097c4d968021ee4fad1b033be5825ff78330e (diff) |
md: use MD_RECOVERY_INTR instead of kthread_should_stop in resync thread.
We currently use kthread_should_stop() in various places in the
sync/reshape code to abort early.
However some places set MD_RECOVERY_INTR but don't immediately call
md_reap_sync_thread() (and we will shortly get another one).
When this happens we are relying on md_check_recovery() to reap the
thread and that only happen when it finishes normally.
So MD_RECOVERY_INTR must lead to a normal finish without the
kthread_should_stop() test.
So replace all relevant tests, and be more careful when the thread is
interrupted not to acknowledge that latest step in a reshape as it may
not be fully committed yet.
Also add a test on MD_RECOVERY_INTR in the 'is_mddev_idle' loop
so we don't wait have to wait for the speed to drop before we can abort.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 73dc8a377522..4f87ba5f3a66 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -4386,7 +4386,11 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, | |||
4386 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 4386 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
4387 | md_wakeup_thread(mddev->thread); | 4387 | md_wakeup_thread(mddev->thread); |
4388 | wait_event(mddev->sb_wait, mddev->flags == 0 || | 4388 | wait_event(mddev->sb_wait, mddev->flags == 0 || |
4389 | kthread_should_stop()); | 4389 | test_bit(MD_RECOVERY_INTR, &mddev->recovery)); |
4390 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | ||
4391 | allow_barrier(conf); | ||
4392 | return sectors_done; | ||
4393 | } | ||
4390 | conf->reshape_safe = mddev->reshape_position; | 4394 | conf->reshape_safe = mddev->reshape_position; |
4391 | allow_barrier(conf); | 4395 | allow_barrier(conf); |
4392 | } | 4396 | } |