diff mbox series

[4/7] md: call md_reap_sync_thread from __md_stop_writes

Message ID ceeca667-ecc5-a776-8c89-9bf6facb93c9@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Mike Snitzer
Headers show
Series MD fixes for the LVM2 testsuite | expand

Commit Message

Mikulas Patocka Jan. 17, 2024, 6:20 p.m. UTC
The commit f52f5c71f3d4 ("md: fix stopping sync thread") breaks the LVM2
test shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh

There are many places that test for MD_RECOVERY_RUNNING or
mddev->sync_thread. If we don't reap the thread, they would be confused.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: f52f5c71f3d4 ("md: fix stopping sync thread")
Cc: stable@vger.kernel.org	# v6.7

---
 drivers/md/md.c |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Yu Kuai Jan. 18, 2024, 1:38 a.m. UTC | #1
Hi,

在 2024/01/18 2:20, Mikulas Patocka 写道:
> The commit f52f5c71f3d4 ("md: fix stopping sync thread") breaks the LVM2
> test shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh
> 
> There are many places that test for MD_RECOVERY_RUNNING or
> mddev->sync_thread. If we don't reap the thread, they would be confused.

Please stop this... make sure you understand the lifetime of
sync_thread before you send such patch. I already explained in
f52f5c71f3d4 why md_reap_sync_thread() can't be called here.

Thanks,
Kuai

> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Fixes: f52f5c71f3d4 ("md: fix stopping sync thread")
> Cc: stable@vger.kernel.org	# v6.7
> 
> ---
>   drivers/md/md.c |    6 ++++++
>   1 file changed, 6 insertions(+)
> 
> Index: linux-2.6/drivers/md/md.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/md.c
> +++ linux-2.6/drivers/md/md.c
> @@ -6308,6 +6308,12 @@ static void md_clean(struct mddev *mddev
>   static void __md_stop_writes(struct mddev *mddev)
>   {
>   	stop_sync_thread(mddev, true, false);
> +
> +	if (mddev->sync_thread) {
> +		set_bit(MD_RECOVERY_INTR, &mddev->recovery);
> +		md_reap_sync_thread(mddev);
> +	}
> +
>   	del_timer_sync(&mddev->safemode_timer);
>   
>   	if (mddev->pers && mddev->pers->quiesce) {
> 
> .
>
diff mbox series

Patch

Index: linux-2.6/drivers/md/md.c
===================================================================
--- linux-2.6.orig/drivers/md/md.c
+++ linux-2.6/drivers/md/md.c
@@ -6308,6 +6308,12 @@  static void md_clean(struct mddev *mddev
 static void __md_stop_writes(struct mddev *mddev)
 {
 	stop_sync_thread(mddev, true, false);
+
+	if (mddev->sync_thread) {
+		set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+		md_reap_sync_thread(mddev);
+	}
+
 	del_timer_sync(&mddev->safemode_timer);
 
 	if (mddev->pers && mddev->pers->quiesce) {