Skip to content

Commit

Permalink
md: fix missing flush of sync_work
Browse files Browse the repository at this point in the history
Commit ac61978 ("md: use separate work_struct for md_start_sync()")
use a new sync_work to replace del_work, however, stop_sync_thread() and
__md_stop_writes() was trying to wait for sync_thread to be done, hence
they should switch to use sync_work as well.

Noted that md_start_sync() from sync_work will grab 'reconfig_mutex',
hence other contex can't held the same lock to flush work, and this will
be fixed in later patches.

Fixes: ac61978 ("md: use separate work_struct for md_start_sync()")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20231205094215.1824240-2-yukuai1@huaweicloud.com
  • Loading branch information
Yu Kuai authored and Song Liu committed Dec 6, 2023
1 parent c467e97 commit f2d87a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -4857,7 +4857,7 @@ static void stop_sync_thread(struct mddev *mddev)
return;
}

if (work_pending(&mddev->del_work))
if (work_pending(&mddev->sync_work))
flush_workqueue(md_misc_wq);

set_bit(MD_RECOVERY_INTR, &mddev->recovery);
Expand Down Expand Up @@ -6265,7 +6265,7 @@ static void md_clean(struct mddev *mddev)
static void __md_stop_writes(struct mddev *mddev)
{
set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
if (work_pending(&mddev->del_work))
if (work_pending(&mddev->sync_work))
flush_workqueue(md_misc_wq);
if (mddev->sync_thread) {
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
Expand Down

0 comments on commit f2d87a7

Please sign in to comment.