md: use work_busy() to flush sync_work in stop_sync_thread()
Subsystems (2)
PATCH v6 1/2 md: use work_busy() to flush sync_work in stop_sync_thread()
From: Li Youhong <[email protected]>
stop_sync_thread() only flushes sync_work when work_pending() is true. Once the work is running, PENDING is cleared, so an in-flight md_start_sync() can be missed and teardown can race with it.
Use work_busy() instead, so both queued and executing sync_work are flushed.
Fixes f52f5c71f3d4 ("md: fix stopping sync thread")
Signed-off-by Li Youhong <[email protected]>
---
drivers/md/md.c +1 -1
@@ -5213,7 +5213,7 @@ static void stop_sync_thread(struct mddev *mddev, bool locked)* never happen */ md_wakeup_thread_directly (&mddev->sync_thread); -if (work_pending (&mddev->sync_work)) +if (work_busy (&mddev->sync_work))flush_work (&mddev->sync_work); wait_event(resync_wait,
Hi,
Sorry, this series was not sent correctly (the patches were not posted as one continuous, dependent series). Please ignore it.
I will resend a corrected v6 shortly.
Thanks,
Li Youhong