Re: [PATCH v3] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
From: Mikulas Patocka
Date: Mon Nov 30 2026 - 07:44:50 EST
Applied, thanks.
Mikulas
On Sun, 29 Nov 2026, nenkov2004@xxxxxxxxx wrote:
> 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.
>
> Fixes: 644e2537fdc7 ("dm raid: fix stripe adding reshape deadlock")
> Suggested-by: Yu Kuai <yukuai@xxxxxxx>
> Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@xxxxxxx
> Reviewed-by: Yu Kuai <yukuai@xxxxxxx>
> Signed-off-by: Hristos Nenkov <nenkov2004@xxxxxxxxx>
> ---
> Changes in v3:
> - Add the Fixes and Reviewed-by trailers from Yu Kuai's review.
> - Resend only the dm-raid patch. Yu Kuai has applied the RAID10 patch.
>
> 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)
>
>
> On Sun, 29 Nov 2026 15:15:54 +0800, yu kuai <yukuai@xxxxxxx> wrote:
> > 在 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
>