From: Yu Kuai <yukuai3@xxxxxxxxxx> Instead of wake_up_process() directly, convert to use md_wakeup_thread(). Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx> --- drivers/md/md.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 97e87df4ee43..4ecfd0508afb 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -6267,10 +6267,12 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) } if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) set_bit(MD_RECOVERY_INTR, &mddev->recovery); - if (mddev->sync_thread) - /* Thread might be blocked waiting for metadata update - * which will now never happen */ - wake_up_process(mddev->sync_thread->tsk); + + /* + * Thread might be blocked waiting for metadata update + * which will now never happen + */ + md_wakeup_thread(&mddev->sync_thread, mddev); if (mddev->external && test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) return -EBUSY; @@ -6331,10 +6333,12 @@ static int do_md_stop(struct mddev *mddev, int mode, } if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) set_bit(MD_RECOVERY_INTR, &mddev->recovery); - if (mddev->sync_thread) - /* Thread might be blocked waiting for metadata update - * which will now never happen */ - wake_up_process(mddev->sync_thread->tsk); + + /* + * Thread might be blocked waiting for metadata update + * which will now never happen + */ + md_wakeup_thread(&mddev->sync_thread, mddev); mddev_unlock(mddev); wait_event(resync_wait, (mddev->sync_thread == NULL && -- 2.31.1