summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c5
-rw-r--r--drivers/md/raid10.c2
2 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7265d117afd7..ef1dae2770ca 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5989,9 +5989,8 @@ static int md_thread(void * arg)
|| kthread_should_stop(),
thread->timeout);
- clear_bit(THREAD_WAKEUP, &thread->flags);
-
- thread->run(thread->mddev);
+ if (test_and_clear_bit(THREAD_WAKEUP, &thread->flags))
+ thread->run(thread->mddev);
}
return 0;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index d1d689126346..66fe4874ffd8 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2393,13 +2393,13 @@ static int run(mddev_t *mddev)
return 0;
out_free_conf:
+ md_unregister_thread(mddev->thread);
if (conf->r10bio_pool)
mempool_destroy(conf->r10bio_pool);
safe_put_page(conf->tmppage);
kfree(conf->mirrors);
kfree(conf);
mddev->private = NULL;
- md_unregister_thread(mddev->thread);
out:
return -EIO;
}