From: Yu Kuai <[email protected]>

Now that previous patch make sure that stop_sync_thread() can successfully
stop sync_thread, and lvm2 tests won't hang anymore. However, the test
lvconvert-raid-reshape.sh still fail and complain that ext4 is
corrupted.

The root cause is still not clear yet, however, let's convert dm-raid
back to use md_reap_sync_thread() directly. This is not safe but at
least there won't be new regressions. We can decide what to do after
figuring out the root cause.

Signed-off-by: Yu Kuai <[email protected]>
---
 drivers/md/md.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7db749ba7e60..3e8dd020bf9f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4909,6 +4909,14 @@ static void stop_sync_thread(struct mddev *mddev, bool 
locked, bool check_seq)
        if (work_pending(&mddev->sync_work))
                flush_work(&mddev->sync_work);
 
+       if (!mddev->gendisk) {
+               mddev_lock_nointr(mddev);
+               md_reap_sync_thread(mddev);
+               if (!locked)
+                       mddev_unlock(mddev);
+               return;
+       }
+
        wait_event(resync_wait,
                   !test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
                   (check_seq && sync_seq != atomic_read(&mddev->sync_seq)));
-- 
2.39.2


Reply via email to