lkml.org 
[lkml]   [2023]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH -next 3/5] md: use md_thread api to wake up sync_thread
    Date
    From: Yu Kuai <yukuai3@huawei.com>

    Instead of wake_up_process() directly, convert to use
    md_wakeup_thread().

    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    ---
    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
    \
     
     \ /
      Last update: 2023-03-27 00:54    [W:2.663 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site