Re: [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
From: yu kuai
Date: Sun Nov 29 2026 - 02:16:11 EST
在 2026/11/20 19:17, nenkov2004@xxxxxxxxx 写道:
> From: Hristos Nenkov <nenkov2004@xxxxxxxxx>
>
> rs_start_reshape() sets MD_RECOVERY_WAIT to keep the sync thread
> from running before the table reload. If setup, check_reshape() or
> start_reshape() fails, raid_preresume() logs the error and continues
> without a reshape. There is no reshape-related table reload to wait for.
>
> Clear MD_RECOVERY_WAIT on those error paths. Keep the bit set when
> reshape setup succeeds.
>
> Suggested-by: Yu Kuai <yukuai@xxxxxxx>
> Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@xxxxxxx
> Signed-off-by: Hristos Nenkov <nenkov2004@xxxxxxxxx>
With following tag:
Fixes: 644e2537fdc7 ("dm raid: fix stripe adding reshape deadlock")
Reviewed-by: Yu Kuai <yukuai@xxxxxxx>
> ---
> drivers/md/dm-raid.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
> index ac019a0f5..e132951f3 100644
> --- a/drivers/md/dm-raid.c
> +++ b/drivers/md/dm-raid.c
> @@ -4004,7 +4004,7 @@ static int rs_start_reshape(struct raid_set *rs)
>
> r = rs_setup_reshape(rs);
> if (r)
> - return r;
> + goto clear_recovery_wait;
>
> /*
> * Check any reshape constraints enforced by the personalility
> @@ -4014,7 +4014,7 @@ static int rs_start_reshape(struct raid_set *rs)
> r = pers->check_reshape(mddev);
> if (r) {
> rs->ti->error = "pers->check_reshape() failed";
> - return r;
> + goto clear_recovery_wait;
> }
>
> /*
> @@ -4025,7 +4025,7 @@ static int rs_start_reshape(struct raid_set *rs)
> r = pers->start_reshape(mddev);
> if (r) {
> rs->ti->error = "pers->start_reshape() failed";
> - return r;
> + goto clear_recovery_wait;
> }
> }
>
> @@ -4037,6 +4037,10 @@ static int rs_start_reshape(struct raid_set *rs)
> rs_update_sbs(rs);
>
> return 0;
> +
> +clear_recovery_wait:
> + clear_bit(MD_RECOVERY_WAIT, &mddev->recovery);
> + return r;
> }
>
> static int raid_preresume(struct dm_target *ti)
--
Thanks,
Kuai