Skip to content

Commit f2d87a7

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
md: fix missing flush of sync_work
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
1 parent c467e97 commit f2d87a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/md.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4857,7 +4857,7 @@ static void stop_sync_thread(struct mddev *mddev)
48574857
return;
48584858
}
48594859

4860-
if (work_pending(&mddev->del_work))
4860+
if (work_pending(&mddev->sync_work))
48614861
flush_workqueue(md_misc_wq);
48624862

48634863
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
@@ -6265,7 +6265,7 @@ static void md_clean(struct mddev *mddev)
62656265
static void __md_stop_writes(struct mddev *mddev)
62666266
{
62676267
set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
6268-
if (work_pending(&mddev->del_work))
6268+
if (work_pending(&mddev->sync_work))
62696269
flush_workqueue(md_misc_wq);
62706270
if (mddev->sync_thread) {
62716271
set_bit(MD_RECOVERY_INTR, &mddev->recovery);

0 commit comments

Comments
 (0)