2024-06-01 09:06:28

by Li Nan

[permalink] [raw]
Subject: [PATCH] md/dm-raid: don't clear MD_RECOVERY_FROZEN after setting frozen

From: Li Nan <[email protected]>

MD_RECOVERY_FROZEN should always remain set after array is frozen. But
in raid_message(), this flag is cleared soon after frozen. Fix it. This
flag will be cleared in md_idle_sync_thread(), there is no need to clear
it again for idle.

Fixes: cd32b27a66db ("md/dm-raid: don't call md_reap_sync_thread() directly")
Signed-off-by: Li Nan <[email protected]>
---
drivers/md/dm-raid.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index abe88d1e6735..466740a3a522 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3744,9 +3744,10 @@ static int raid_message(struct dm_target *ti, unsigned int argc, char **argv,

md_idle_sync_thread(mddev);
mddev_unlock(mddev);
+ } else {
+ clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
}

- clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
if (decipher_sync_action(mddev, mddev->recovery) != st_idle)
return -EBUSY;
else if (!strcasecmp(argv[0], "resync"))
--
2.39.2



2024-06-03 02:50:52

by Yu Kuai

[permalink] [raw]
Subject: Re: [PATCH] md/dm-raid: don't clear MD_RECOVERY_FROZEN after setting frozen

?? 2024/06/01 17:06, [email protected] ะด??:
> From: Li Nan <[email protected]>
>
> MD_RECOVERY_FROZEN should always remain set after array is frozen. But
> in raid_message(), this flag is cleared soon after frozen. Fix it. This
> flag will be cleared in md_idle_sync_thread(), there is no need to clear
> it again for idle.
>
> Fixes: cd32b27a66db ("md/dm-raid: don't call md_reap_sync_thread() directly")
> Signed-off-by: Li Nan <[email protected]>
> ---
> drivers/md/dm-raid.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
> index abe88d1e6735..466740a3a522 100644
> --- a/drivers/md/dm-raid.c
> +++ b/drivers/md/dm-raid.c
> @@ -3744,9 +3744,10 @@ static int raid_message(struct dm_target *ti, unsigned int argc, char **argv,
>
> md_idle_sync_thread(mddev);
> mddev_unlock(mddev);
> + } else {
> + clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
> }
>
> - clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);

LGTM
Reviewed-by: Yu Kuai <[email protected]>

> if (decipher_sync_action(mddev, mddev->recovery) != st_idle)
> return -EBUSY;
> else if (!strcasecmp(argv[0], "resync"))
>