* [PATCH] md/raid10: preserve recovery flags on reshape abort
[not found] <6aec6738.059f5055.2712e4.0005.GAE@google.com>
@ 2026-11-10 5:44 ` Hristos Nenkov
2026-11-20 7:05 ` yu kuai
0 siblings, 1 reply; 10+ messages in thread
From: Hristos Nenkov @ 2026-11-10 5:44 UTC (permalink / raw)
To: Song Liu, linux-raid
Cc: Yu Kuai, Li Nan, Xiao Ni, NeilBrown, dm-devel, linux-kernel,
Alasdair Kergon, Mike Snitzer, Mikulas Patocka,
Benjamin Marzinski, syzbot+8b22a0459202f76b4096, Hristos Nenkov
raid10_start_reshape() can fail while resizing a bitmap before it
changes any recovery bits on its success path. Its abort path nevertheless
clears the entire mddev->recovery bitmap.
dm-raid keeps MD_RECOVERY_FROZEN set across suspend and resume. If RAID10
reshape setup fails, raid_preresume() logs the failure and continues with
resume. Clearing the bitmap removes MD_RECOVERY_FROZEN and makes
raid_resume() hit its invariant warning.
Do not clear mddev->recovery from the RAID10 abort path. The error paths
reach abort before raid10_start_reshape() modifies the recovery bits, so
there is no personality-owned recovery state to roll back there.
Fixes: bb63a7019df9 ("md/raid10: resize bitmap when required during reshape.")
Reported-by: syzbot+8b22a0459202f76b4096@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8b22a0459202f76b4096
Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
---
drivers/md/raid10.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 066c43154..1fd3f5f4f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4490,7 +4490,6 @@ static int raid10_start_reshape(struct mddev *mddev)
return 0;
abort:
- mddev->recovery = 0;
spin_lock_irq(&conf->device_lock);
conf->geo = conf->prev;
mddev->raid_disks = conf->geo.raid_disks;
base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] md/raid10: preserve recovery flags on reshape abort
2026-11-10 5:44 ` [PATCH] md/raid10: preserve recovery flags on reshape abort Hristos Nenkov
@ 2026-11-20 7:05 ` yu kuai
2026-11-20 11:17 ` [PATCH v2 0/2] Fix recovery flags on failed RAID10 reshape nenkov2004
0 siblings, 1 reply; 10+ messages in thread
From: yu kuai @ 2026-11-20 7:05 UTC (permalink / raw)
To: Hristos Nenkov, Song Liu, linux-raid, yu kuai
Cc: Li Nan, Xiao Ni, NeilBrown, dm-devel, linux-kernel,
Alasdair Kergon, Mike Snitzer, Mikulas Patocka,
Benjamin Marzinski, syzbot+8b22a0459202f76b4096
Hi,
在 2026/11/10 13:44, Hristos Nenkov 写道:
> raid10_start_reshape() can fail while resizing a bitmap before it
> changes any recovery bits on its success path. Its abort path nevertheless
> clears the entire mddev->recovery bitmap.
>
> dm-raid keeps MD_RECOVERY_FROZEN set across suspend and resume. If RAID10
> reshape setup fails, raid_preresume() logs the failure and continues with
> resume. Clearing the bitmap removes MD_RECOVERY_FROZEN and makes
> raid_resume() hit its invariant warning.
>
> Do not clear mddev->recovery from the RAID10 abort path. The error paths
> reach abort before raid10_start_reshape() modifies the recovery bits, so
> there is no personality-owned recovery state to roll back there.
>
> Fixes: bb63a7019df9 ("md/raid10: resize bitmap when required during reshape.")
> Reported-by: syzbot+8b22a0459202f76b4096@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=8b22a0459202f76b4096
> Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
> ---
> drivers/md/raid10.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 066c43154..1fd3f5f4f 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -4490,7 +4490,6 @@ static int raid10_start_reshape(struct mddev *mddev)
> return 0;
>
> abort:
> - mddev->recovery = 0;
This is not quite related to this patch, but take a look at rs_start_reshape(),
MD_RECOVERY_WAIT is set before calling pers->start_reshape(), and it's never
cleared from error path.
This should probably be fixed first, and then it's safe to remove the above line.
> spin_lock_irq(&conf->device_lock);
> conf->geo = conf->prev;
> mddev->raid_disks = conf->geo.raid_disks;
>
> base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
--
Thanks,
Kuai
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 0/2] Fix recovery flags on failed RAID10 reshape
2026-11-20 7:05 ` yu kuai
@ 2026-11-20 11:17 ` nenkov2004
2026-11-20 11:17 ` [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure nenkov2004
2026-11-20 11:17 ` [PATCH v2 2/2] md/raid10: Preserve recovery flags on reshape abort nenkov2004
0 siblings, 2 replies; 10+ messages in thread
From: nenkov2004 @ 2026-11-20 11:17 UTC (permalink / raw)
To: linux-raid, yukuai, song
Cc: dm-devel, linux-kernel, magiclinan, xiao, neil, agk, snitzer,
mpatocka, bmarzins, syzbot+8b22a0459202f76b4096, Hristos Nenkov
From: Hristos Nenkov <nenkov2004@gmail.com>
Hi Kuai,
Thanks for the review. This revision implements the ordering you
suggested. Patch 1 clears MD_RECOVERY_WAIT in dm-raid on all three
reshape setup errors. Patch 2 removes the recovery-word reset from
the RAID10 abort path.
Checks: checkpatch reported no errors or warnings for either diff.
Both affected kernel objects built in WSL. Five focused userspace
checks passed for the dm-raid flag handling. I did not run a
live-kernel reshape regression test.
I used OpenAI Codex to apply the review feedback, prepare the v2
changelog and run the checks above.
Changes in v2:
- Add the dm-raid error-path fix first, as suggested by Yu Kuai.
- Keep the original RAID10 change as the second patch.
Hristos Nenkov (2):
dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
md/raid10: Preserve recovery flags on reshape abort
drivers/md/dm-raid.c | 10 +++++++---
drivers/md/raid10.c | 1 -
2 files changed, 7 insertions(+), 4 deletions(-)
base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
2026-11-20 11:17 ` [PATCH v2 0/2] Fix recovery flags on failed RAID10 reshape nenkov2004
@ 2026-11-20 11:17 ` nenkov2004
2026-11-20 11:22 ` sashiko-bot
2026-11-29 7:15 ` yu kuai
2026-11-20 11:17 ` [PATCH v2 2/2] md/raid10: Preserve recovery flags on reshape abort nenkov2004
1 sibling, 2 replies; 10+ messages in thread
From: nenkov2004 @ 2026-11-20 11:17 UTC (permalink / raw)
To: linux-raid, yukuai, song
Cc: dm-devel, linux-kernel, magiclinan, xiao, neil, agk, snitzer,
mpatocka, bmarzins, syzbot+8b22a0459202f76b4096, Hristos Nenkov
From: Hristos Nenkov <nenkov2004@gmail.com>
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@fygo.io>
Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@fygo.io
Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
---
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)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] md/raid10: Preserve recovery flags on reshape abort
2026-11-20 11:17 ` [PATCH v2 0/2] Fix recovery flags on failed RAID10 reshape nenkov2004
2026-11-20 11:17 ` [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure nenkov2004
@ 2026-11-20 11:17 ` nenkov2004
2026-11-29 7:36 ` yu kuai
1 sibling, 1 reply; 10+ messages in thread
From: nenkov2004 @ 2026-11-20 11:17 UTC (permalink / raw)
To: linux-raid, yukuai, song
Cc: dm-devel, linux-kernel, magiclinan, xiao, neil, agk, snitzer,
mpatocka, bmarzins, syzbot+8b22a0459202f76b4096, Hristos Nenkov
From: Hristos Nenkov <nenkov2004@gmail.com>
raid10_start_reshape() can fail before it updates the recovery flags.
Its abort path clears the entire recovery word, including the
MD_RECOVERY_FROZEN bit that dm-raid requires until raid_resume().
Keep the recovery word intact when rolling back reshape setup. The
preceding dm-raid change clears MD_RECOVERY_WAIT on failure in the
caller that set it.
Fixes: bb63a7019df9 ("md/raid10: resize bitmap when required during reshape.")
Reported-by: syzbot+8b22a0459202f76b4096@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8b22a0459202f76b4096
Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
---
drivers/md/raid10.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 066c43154..1fd3f5f4f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4490,7 +4490,6 @@ static int raid10_start_reshape(struct mddev *mddev)
return 0;
abort:
- mddev->recovery = 0;
spin_lock_irq(&conf->device_lock);
conf->geo = conf->prev;
mddev->raid_disks = conf->geo.raid_disks;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
2026-11-20 11:17 ` [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure nenkov2004
@ 2026-11-20 11:22 ` sashiko-bot
2026-11-29 7:15 ` yu kuai
1 sibling, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-11-20 11:22 UTC (permalink / raw)
To: nenkov2004, linux-raid, yukuai, song
Cc: dm-devel, magiclinan, xiao, neil, agk, snitzer, mpatocka,
bmarzins, syzbot+8b22a0459202f76b4096
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dm raid: missing Fixes trailer for rs_start_reshape() error
cleanup
--
commit 6a83155083baad91c84f61814a141b78b22b8537
Author: Hristos Nenkov <nenkov2004@gmail.com>
> dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
>
> 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@fygo.io>
> Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@fygo.io
> Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
[Severity: Low]
Commit 644e2537fdc7 ("dm raid: fix stripe adding reshape deadlock") added
set_bit(MD_RECOVERY_WAIT, &mddev->recovery) at the start of
rs_start_reshape() without clearing it on the error return paths. Should
this include:
Fixes: 644e2537fdc7 ("dm raid: fix stripe adding reshape deadlock")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120111757.4705-1-nenkov2004@gmail.com?part=1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
2026-11-20 11:17 ` [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure nenkov2004
2026-11-20 11:22 ` sashiko-bot
@ 2026-11-29 7:15 ` yu kuai
2026-11-29 15:37 ` [PATCH v3] " nenkov2004
1 sibling, 1 reply; 10+ messages in thread
From: yu kuai @ 2026-11-29 7:15 UTC (permalink / raw)
To: nenkov2004, linux-raid, song, yu kuai
Cc: dm-devel, linux-kernel, magiclinan, xiao, neil, agk, snitzer,
mpatocka, bmarzins, syzbot+8b22a0459202f76b4096
在 2026/11/20 19:17, nenkov2004@gmail.com 写道:
> From: Hristos Nenkov <nenkov2004@gmail.com>
>
> 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@fygo.io>
> Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@fygo.io
> Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
With following tag:
Fixes: 644e2537fdc7 ("dm raid: fix stripe adding reshape deadlock")
Reviewed-by: Yu Kuai <yukuai@fygo.io>
> ---
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] md/raid10: Preserve recovery flags on reshape abort
2026-11-20 11:17 ` [PATCH v2 2/2] md/raid10: Preserve recovery flags on reshape abort nenkov2004
@ 2026-11-29 7:36 ` yu kuai
0 siblings, 0 replies; 10+ messages in thread
From: yu kuai @ 2026-11-29 7:36 UTC (permalink / raw)
To: nenkov2004, linux-raid, song, yu kuai
Cc: dm-devel, linux-kernel, magiclinan, xiao, neil, agk, snitzer,
mpatocka, bmarzins, syzbot+8b22a0459202f76b4096
在 2026/11/20 19:17, nenkov2004@gmail.com 写道:
> raid10_start_reshape() can fail before it updates the recovery flags.
> Its abort path clears the entire recovery word, including the
> MD_RECOVERY_FROZEN bit that dm-raid requires until raid_resume().
>
> Keep the recovery word intact when rolling back reshape setup. The
> preceding dm-raid change clears MD_RECOVERY_WAIT on failure in the
> caller that set it.
>
> Fixes: bb63a7019df9 ("md/raid10: resize bitmap when required during reshape.")
> Reported-by:syzbot+8b22a0459202f76b4096@syzkaller.appspotmail.com
> Closes:https://syzkaller.appspot.com/bug?extid=8b22a0459202f76b4096
> Signed-off-by: Hristos Nenkov<nenkov2004@gmail.com>
> ---
> drivers/md/raid10.c | 1 -
> 1 file changed, 1 deletion(-)
Applied patch 2.
--
Thanks,
Kuai
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
2026-11-29 7:15 ` yu kuai
@ 2026-11-29 15:37 ` nenkov2004
2026-11-30 12:44 ` Mikulas Patocka
0 siblings, 1 reply; 10+ messages in thread
From: nenkov2004 @ 2026-11-29 15:37 UTC (permalink / raw)
To: yukuai, linux-raid, song
Cc: dm-devel, linux-kernel, magiclinan, xiao, neil, agk, snitzer,
mpatocka, bmarzins, syzbot+8b22a0459202f76b4096
From: Hristos Nenkov <nenkov2004@gmail.com>
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@fygo.io>
Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@fygo.io
Reviewed-by: Yu Kuai <yukuai@fygo.io>
Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
---
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@fygo.io> wrote:
> 在 2026/11/20 19:17, nenkov2004@gmail.com 写道:
>
> > From: Hristos Nenkov <nenkov2004@gmail.com>
> >
> > 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@fygo.io>
> > Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@fygo.io
> > Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
>
> With following tag:
> Fixes: 644e2537fdc7 ("dm raid: fix stripe adding reshape deadlock")
>
> Reviewed-by: Yu Kuai <yukuai@fygo.io>
>
> > ---
> > 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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
2026-11-29 15:37 ` [PATCH v3] " nenkov2004
@ 2026-11-30 12:44 ` Mikulas Patocka
0 siblings, 0 replies; 10+ messages in thread
From: Mikulas Patocka @ 2026-11-30 12:44 UTC (permalink / raw)
To: nenkov2004
Cc: yukuai, linux-raid, song, dm-devel, linux-kernel, magiclinan,
xiao, neil, agk, snitzer, bmarzins, syzbot+8b22a0459202f76b4096
[-- Attachment #1: Type: text/plain, Size: 4602 bytes --]
Applied, thanks.
Mikulas
On Sun, 29 Nov 2026, nenkov2004@gmail.com wrote:
> From: Hristos Nenkov <nenkov2004@gmail.com>
>
> 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@fygo.io>
> Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@fygo.io
> Reviewed-by: Yu Kuai <yukuai@fygo.io>
> Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
> ---
> 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@fygo.io> wrote:
> > 在 2026/11/20 19:17, nenkov2004@gmail.com 写道:
> >
> > > From: Hristos Nenkov <nenkov2004@gmail.com>
> > >
> > > 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@fygo.io>
> > > Link: https://lore.kernel.org/r/4d13edef-f454-437b-8910-3a905697303e@fygo.io
> > > Signed-off-by: Hristos Nenkov <nenkov2004@gmail.com>
> >
> > With following tag:
> > Fixes: 644e2537fdc7 ("dm raid: fix stripe adding reshape deadlock")
> >
> > Reviewed-by: Yu Kuai <yukuai@fygo.io>
> >
> > > ---
> > > 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
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-30 12:44 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <6aec6738.059f5055.2712e4.0005.GAE@google.com>
2026-11-10 5:44 ` [PATCH] md/raid10: preserve recovery flags on reshape abort Hristos Nenkov
2026-11-20 7:05 ` yu kuai
2026-11-20 11:17 ` [PATCH v2 0/2] Fix recovery flags on failed RAID10 reshape nenkov2004
2026-11-20 11:17 ` [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure nenkov2004
2026-11-20 11:22 ` sashiko-bot
2026-11-29 7:15 ` yu kuai
2026-11-29 15:37 ` [PATCH v3] " nenkov2004
2026-11-30 12:44 ` Mikulas Patocka
2026-11-20 11:17 ` [PATCH v2 2/2] md/raid10: Preserve recovery flags on reshape abort nenkov2004
2026-11-29 7:36 ` yu kuai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox