Skip to contentSkip to conversation

md: use work_busy() to flush sync_work in stop_sync_thread()

PATCH Superseded Li Youhong 1 participant 2 messages Nov 26

Subsystems (2)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Li Youhong

author
#0 lore raw

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")

---

drivers/md/md.c +1 -1
index 03e35386a802..1974943bf746 100644
@@ -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,
author
#1 lore raw

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