WARNING in raid_resume
Subsystems (2)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: 8b7179210b22 Add linux-next specific files for 20261104 git tree: linux-next console output: https://syzkaller.appspot.com/x/log.txt?x=149d5969580000 kernel config: https://syzkaller.appspot.com/x/.config?x=5dad87d6a9d5ee90 dashboard link: https://syzkaller.appspot.com/bug?extid=8b22a0459202f76b4096 compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/24dabb992a55/disk-8b717921.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/efb6c59219d5/vmlinux-8b717921.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ced4d906c236/bzImage-8b717921.xz
AI-generated root cause summary:
In dm-raid, the target expects the underlying MD sync thread recovery state to remain frozen (MD_RECOVERY_FROZEN) from creation (raid_ctr()) or postsuspend (raid_postsuspend()) until resume (raid_resume()). When reshaping a RAID10 array with a dirty region bitmap, raid_preresume() executes rs_start_reshape(), which calls raid10_start_reshape(). If an error occurs (such as bitmap resize failure), raid10_start_reshape() branches to its abort label, which unconditionally executes mddev->recovery = 0;, wiping out MD_RECOVERY_FROZEN. Because raid_preresume() swallows the reshape failure to continue without change, the subsequent call to raid_resume() encounters RT_FLAG_RS_SUSPENDED with MD_RECOVERY_FROZEN missing, triggering the assertion WARN_ON_ONCE(!test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)).
full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=8b22a0459202f76b4096
IMPORTANT: if you fix the issue, please add the following tag to the commit:
device-mapper: table: 248:14: thin-pool: Error opening metadata block device (-ENOENT)
device-mapper: ioctl: error adding target to table
mdX: bitmap file is out of date, doing full recovery
------------[ cut here ]------------ !test_bit(MD_RECOVERY_FROZEN, &mddev->recovery) WARNING: drivers/md/dm-raid.c:4139 at raid_resume+0x11fe/0x1290 drivers/md/dm-raid.c:4139, CPU#0: syz.5.1272/11312 Modules linked in: CPU: 0 UID: 0 PID: 11312 Comm: syz.5.1272 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/15/2026 RIP: 0010:raid_resume+0x11fe/0x1290 drivers/md/dm-raid.c:4139 Code: c6 05 0f 85 fc 08 01 48 c7 c7 40 78 3d 8d be 2d 10 00 00 48 c7 c2 e0 b8 3d 8d e8 2d ec d6 f8 e9 b5 fe ff ff e8 13 95 fb f8 90 <0f> 0b 90 e9 63 fe ff ff e8 05 95 fb f8 90 0f 0b 90 e9 c5 fe ff ff RSP: 0018:ffffc900039e78c0 EFLAGS: 00010283 RAX: ffffffff88cdbd5d RBX: 0000000000000000 RCX: 0000000000080000 RDX: ffffc90010680000 RSI: 0000000000001342 RDI: 0000000000001343 RBP: ffffc900039e7a40 R08: ffff888078c6c2bf R09: 1ffff1100f18d857 R10: dffffc0000000000 R11: ffffed100f18d858 R12: 1ffff9200073cf28 R13: ffff888078c6c058 R14: dffffc0000000000 R15: ffff888078c6c000 FS: 00007fbfa88c06c0(0000) GS:ffff888123161000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005561081d2138 CR3: 000000007ce32000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000001800 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Call Trace: <TASK> dm_table_resume_targets+0x299/0x3f0 drivers/md/dm-table.c:2204 __dm_resume+0x22/0x1d0 drivers/md/dm.c:3117 dm_resume+0x21a/0x2e0 drivers/md/dm.c:3163 do_resume drivers/md/dm-ioctl.c:1332 [inline] dev_suspend+0x6ff/0xaa0 drivers/md/dm-ioctl.c:1368 ctl_ioctl drivers/md/dm-ioctl.c:2221 [inline] dm_ctl_ioctl+0x9ec/0xe10 drivers/md/dm-ioctl.c:2243 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x00007fbfa799fb19 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fbfa88c0028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fbfa7c25fa0 RCX: 00007fbfa799fb19 RDX: 0000200000000480 RSI: 00000000c138fd06 RDI: 0000000000000003 RBP: 00007fbfa7a37b70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fbfa7c26038 R14: 00007fbfa7c25fa0 R15: 00007fffea1356a8 </TASK>
---
This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at [email protected].
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
PATCH 1/1 md/raid10: preserve recovery flags on reshape abort
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.
--- drivers/md/raid10.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/raid10.c +0 -1
@@ -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
Signature · 1 line
2.43.0
yu kuai
maintainerRe: [PATCH] md/raid10: preserve recovery flags on reshape abort
Hi,
Quoted 26 lines · 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 entiremddev->recoverybitmap.dm-raid keeps
MD_RECOVERY_FROZENset across suspend and resume. If RAID10 reshape setup fails,raid_preresume()logs the failure and continues with resume. Clearing the bitmap removesMD_RECOVERY_FROZENand makesraid_resume()hit its invariant warning.Do not clear
mddev->recoveryfrom the RAID10 abort path. The error paths reach abort beforeraid10_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 [email protected]Signed-off-by Hristos Nenkov <[email protected]>--- drivers/md/raid10.c | 1 - 1 file changed, 1 deletion(-)drivers/md/raid10.c +0
-0
drivers/md/raid10.c static int raid10_start_reshape(struct mddev *mddev) · line 4493
Quoted 4 lines
drivers/md/raid10.c +0
-1@@ -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.
Quoted 5 lines
drivers/md/raid10.c +0
-0spin_lock_irq (&conf->device_lock); conf->geo = conf->prev; mddev->raid_disks = conf->geo.raid_disks;base-commit:
b3dfbde62cf1981c4638939c159dfd087b7a72e9
Signature · 2 lines
Thanks, Kuai
v2 cover Fix recovery flags on failed RAID10 reshape
From: Hristos Nenkov <[email protected]>
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
PATCH v2 1/2 dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
From: Hristos Nenkov <[email protected]>
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.
--- drivers/md/dm-raid.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/md/dm-raid.c +7 -3
@@ -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)
[email protected]
AI reviewRe: [PATCH v2 1/2] dm raid: Clear MD_RECOVERY_WAIT on reshape setup failure
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 --
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 <[email protected]>
Quoted 7 lines
dm raid: Clear
MD_RECOVERY_WAITon reshape setup failure
rs_start_reshape()setsMD_RECOVERY_WAITto keep the sync thread from running before the table reload. If setup,check_reshape()orstart_reshape()fails,raid_preresume()logs the error and continues without a reshape. There is no reshape-related table reload to wait for.
Quoted 6 lines
Clear
MD_RECOVERY_WAITon those error paths. Keep the bit set when reshape setup succeeds.Suggested-by Yu Kuai <[email protected]>Signed-off-by Hristos Nenkov <[email protected]>
[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:
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 2/2 md/raid10: Preserve recovery flags on reshape abort
In reply to [email protected]From: Hristos Nenkov <[email protected]>
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.
--- drivers/md/raid10.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/raid10.c +0 -1
@@ -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;