diff options
author | NeilBrown <neilb@suse.de> | 2005-10-26 04:58:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-26 13:39:42 -0400 |
commit | 8712e553562bbbed9b3a99370f08e9bc25908a76 (patch) | |
tree | be13964a0701d19f9363a91ed5a130ed10ed4016 | |
parent | 6693e74a16ef563960764bd963f1048392135c3c (diff) |
[PATCH] md: make sure mdthreads will always respond to kthread_stop
There are still a couple of cases where md threads (the resync/recovery
thread) is not interruptible since the change to use kthreads. All places
there it tests "signal_pending", it should also test kthread_should_stop,
as with this patch.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/md/md.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index e9476075aa13..2a8a5696bf8a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3568,7 +3568,8 @@ static void md_do_sync(mddev_t *mddev) | |||
3568 | mddev->curr_resync = 2; | 3568 | mddev->curr_resync = 2; |
3569 | 3569 | ||
3570 | try_again: | 3570 | try_again: |
3571 | if (signal_pending(current)) { | 3571 | if (signal_pending(current) || |
3572 | kthread_should_stop()) { | ||
3572 | flush_signals(current); | 3573 | flush_signals(current); |
3573 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 3574 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
3574 | goto skip; | 3575 | goto skip; |
@@ -3590,8 +3591,9 @@ static void md_do_sync(mddev_t *mddev) | |||
3590 | */ | 3591 | */ |
3591 | continue; | 3592 | continue; |
3592 | prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE); | 3593 | prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE); |
3593 | if (!signal_pending(current) | 3594 | if (!signal_pending(current) && |
3594 | && mddev2->curr_resync >= mddev->curr_resync) { | 3595 | !kthread_should_stop() && |
3596 | mddev2->curr_resync >= mddev->curr_resync) { | ||
3595 | printk(KERN_INFO "md: delaying resync of %s" | 3597 | printk(KERN_INFO "md: delaying resync of %s" |
3596 | " until %s has finished resync (they" | 3598 | " until %s has finished resync (they" |
3597 | " share one or more physical units)\n", | 3599 | " share one or more physical units)\n", |
@@ -3697,7 +3699,7 @@ static void md_do_sync(mddev_t *mddev) | |||
3697 | } | 3699 | } |
3698 | 3700 | ||
3699 | 3701 | ||
3700 | if (signal_pending(current)) { | 3702 | if (signal_pending(current) || kthread_should_stop()) { |
3701 | /* | 3703 | /* |
3702 | * got a signal, exit. | 3704 | * got a signal, exit. |
3703 | */ | 3705 | */ |