aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2897df90df4..2a8a5696bf8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3063,6 +3063,7 @@ static int md_thread(void * arg)
3063 * many dirty RAID5 blocks. 3063 * many dirty RAID5 blocks.
3064 */ 3064 */
3065 3065
3066 allow_signal(SIGKILL);
3066 complete(thread->event); 3067 complete(thread->event);
3067 while (!kthread_should_stop()) { 3068 while (!kthread_should_stop()) {
3068 void (*run)(mddev_t *); 3069 void (*run)(mddev_t *);
@@ -3111,7 +3112,7 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
3111 thread->mddev = mddev; 3112 thread->mddev = mddev;
3112 thread->name = name; 3113 thread->name = name;
3113 thread->timeout = MAX_SCHEDULE_TIMEOUT; 3114 thread->timeout = MAX_SCHEDULE_TIMEOUT;
3114 thread->tsk = kthread_run(md_thread, thread, mdname(thread->mddev)); 3115 thread->tsk = kthread_run(md_thread, thread, name, mdname(thread->mddev));
3115 if (IS_ERR(thread->tsk)) { 3116 if (IS_ERR(thread->tsk)) {
3116 kfree(thread); 3117 kfree(thread);
3117 return NULL; 3118 return NULL;
@@ -3567,8 +3568,10 @@ static void md_do_sync(mddev_t *mddev)
3567 mddev->curr_resync = 2; 3568 mddev->curr_resync = 2;
3568 3569
3569 try_again: 3570 try_again:
3570 if (signal_pending(current)) { 3571 if (signal_pending(current) ||
3572 kthread_should_stop()) {
3571 flush_signals(current); 3573 flush_signals(current);
3574 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
3572 goto skip; 3575 goto skip;
3573 } 3576 }
3574 ITERATE_MDDEV(mddev2,tmp) { 3577 ITERATE_MDDEV(mddev2,tmp) {
@@ -3588,8 +3591,9 @@ static void md_do_sync(mddev_t *mddev)
3588 */ 3591 */
3589 continue; 3592 continue;
3590 prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE); 3593 prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE);
3591 if (!signal_pending(current) 3594 if (!signal_pending(current) &&
3592 && mddev2->curr_resync >= mddev->curr_resync) { 3595 !kthread_should_stop() &&
3596 mddev2->curr_resync >= mddev->curr_resync) {
3593 printk(KERN_INFO "md: delaying resync of %s" 3597 printk(KERN_INFO "md: delaying resync of %s"
3594 " until %s has finished resync (they" 3598 " until %s has finished resync (they"
3595 " share one or more physical units)\n", 3599 " share one or more physical units)\n",
@@ -3695,7 +3699,7 @@ static void md_do_sync(mddev_t *mddev)
3695 } 3699 }
3696 3700
3697 3701
3698 if (signal_pending(current)) { 3702 if (signal_pending(current) || kthread_should_stop()) {
3699 /* 3703 /*
3700 * got a signal, exit. 3704 * got a signal, exit.
3701 */ 3705 */