All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [f2fs?] kernel BUG in f2fs_write_end_io (2)
@ 2026-05-14 20:19 ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-05-14 20:19 UTC (permalink / raw)
  To: chao, jaegeuk, linux-f2fs-devel, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    aa54b1d27fe0 rxrpc: Also unshare DATA/RESPONSE packets whe..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14adabce580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=f2e8ebfec4636d32
dashboard link: https://syzkaller.appspot.com/bug?extid=4af46ee83100e99bce09
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1643c3ce580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12adabce580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/418e3ed628cf/disk-aa54b1d2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a35b53d0ab2f/vmlinux-aa54b1d2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/03c3fa0081b4/bzImage-aa54b1d2.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/13e397c7f935/mount_0.gz
  fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=158fad06580000)
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/2f91edde40dc/mount_8.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4af46ee83100e99bce09@syzkaller.appspotmail.com

------------[ cut here ]------------
kernel BUG at fs/f2fs/data.c:388!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 31 Comm: ksoftirqd/1 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
RIP: 0010:f2fs_write_end_io+0x16df/0x1740 fs/f2fs/data.c:388
Code: 20 3c 9b 8b e8 12 0a f7 fc 90 0f 0b e8 0a cc 93 fd 48 8b 3c 24 48 c7 c6 20 3c 9b 8b e8 fa 09 f7 fc 90 0f 0b e8 f2 cb 93 fd 90 <0f> 0b e8 ea cb 93 fd 48 8b 3c 24 48 c7 c6 20 3c 9b 8b e8 da 09 f7
RSP: 0018:ffffc90000a5fb18 EFLAGS: 00010246
RAX: ffffffff8430aade RBX: ffffea0000d91c40 RCX: ffff88801d6b0000
RDX: 0000000000000100 RSI: 0000000000000000 RDI: 0000000000000100
RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000100
R10: dffffc0000000000 R11: fffffbfff1f11dff R12: 0000000036471000
R13: ffffea0000d91c80 R14: 000000000000000b R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff888126276000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007eff6352cff8 CR3: 000000002caa2000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 blk_update_request+0x57e/0xe60 block/blk-mq.c:1016
 blk_mq_end_request+0x3e/0x70 block/blk-mq.c:1178
 blk_complete_reqs block/blk-mq.c:1253 [inline]
 blk_done_softirq+0x10a/0x160 block/blk-mq.c:1258
 handle_softirqs+0x1de/0x6d0 kernel/softirq.c:622
 run_ksoftirqd+0x52/0x180 kernel/softirq.c:1076
 smpboot_thread_fn+0x541/0xa50 kernel/smpboot.c:160
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:f2fs_write_end_io+0x16df/0x1740 fs/f2fs/data.c:388
Code: 20 3c 9b 8b e8 12 0a f7 fc 90 0f 0b e8 0a cc 93 fd 48 8b 3c 24 48 c7 c6 20 3c 9b 8b e8 fa 09 f7 fc 90 0f 0b e8 f2 cb 93 fd 90 <0f> 0b e8 ea cb 93 fd 48 8b 3c 24 48 c7 c6 20 3c 9b 8b e8 da 09 f7
RSP: 0018:ffffc90000a5fb18 EFLAGS: 00010246
RAX: ffffffff8430aade RBX: ffffea0000d91c40 RCX: ffff88801d6b0000
RDX: 0000000000000100 RSI: 0000000000000000 RDI: 0000000000000100
RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000100
R10: dffffc0000000000 R11: fffffbfff1f11dff R12: 0000000036471000
R13: ffffea0000d91c80 R14: 000000000000000b R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff888126276000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007eff6352cff8 CR3: 000000002caa2000 CR4: 00000000003526f0


---
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 syzkaller@googlegroups.com.

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 syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [f2fs-dev] [syzbot] [f2fs?] kernel BUG in f2fs_write_end_io (2)
@ 2026-05-14 20:19 ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-05-14 20:19 UTC (permalink / raw)
  To: chao, jaegeuk, linux-f2fs-devel, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    aa54b1d27fe0 rxrpc: Also unshare DATA/RESPONSE packets whe..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14adabce580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=f2e8ebfec4636d32
dashboard link: https://syzkaller.appspot.com/bug?extid=4af46ee83100e99bce09
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1643c3ce580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12adabce580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/418e3ed628cf/disk-aa54b1d2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a35b53d0ab2f/vmlinux-aa54b1d2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/03c3fa0081b4/bzImage-aa54b1d2.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/13e397c7f935/mount_0.gz
  fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=158fad06580000)
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/2f91edde40dc/mount_8.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4af46ee83100e99bce09@syzkaller.appspotmail.com

------------[ cut here ]------------
kernel BUG at fs/f2fs/data.c:388!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 31 Comm: ksoftirqd/1 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
RIP: 0010:f2fs_write_end_io+0x16df/0x1740 fs/f2fs/data.c:388
Code: 20 3c 9b 8b e8 12 0a f7 fc 90 0f 0b e8 0a cc 93 fd 48 8b 3c 24 48 c7 c6 20 3c 9b 8b e8 fa 09 f7 fc 90 0f 0b e8 f2 cb 93 fd 90 <0f> 0b e8 ea cb 93 fd 48 8b 3c 24 48 c7 c6 20 3c 9b 8b e8 da 09 f7
RSP: 0018:ffffc90000a5fb18 EFLAGS: 00010246
RAX: ffffffff8430aade RBX: ffffea0000d91c40 RCX: ffff88801d6b0000
RDX: 0000000000000100 RSI: 0000000000000000 RDI: 0000000000000100
RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000100
R10: dffffc0000000000 R11: fffffbfff1f11dff R12: 0000000036471000
R13: ffffea0000d91c80 R14: 000000000000000b R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff888126276000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007eff6352cff8 CR3: 000000002caa2000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 blk_update_request+0x57e/0xe60 block/blk-mq.c:1016
 blk_mq_end_request+0x3e/0x70 block/blk-mq.c:1178
 blk_complete_reqs block/blk-mq.c:1253 [inline]
 blk_done_softirq+0x10a/0x160 block/blk-mq.c:1258
 handle_softirqs+0x1de/0x6d0 kernel/softirq.c:622
 run_ksoftirqd+0x52/0x180 kernel/softirq.c:1076
 smpboot_thread_fn+0x541/0xa50 kernel/smpboot.c:160
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:f2fs_write_end_io+0x16df/0x1740 fs/f2fs/data.c:388
Code: 20 3c 9b 8b e8 12 0a f7 fc 90 0f 0b e8 0a cc 93 fd 48 8b 3c 24 48 c7 c6 20 3c 9b 8b e8 fa 09 f7 fc 90 0f 0b e8 f2 cb 93 fd 90 <0f> 0b e8 ea cb 93 fd 48 8b 3c 24 48 c7 c6 20 3c 9b 8b e8 da 09 f7
RSP: 0018:ffffc90000a5fb18 EFLAGS: 00010246
RAX: ffffffff8430aade RBX: ffffea0000d91c40 RCX: ffff88801d6b0000
RDX: 0000000000000100 RSI: 0000000000000000 RDI: 0000000000000100
RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000100
R10: dffffc0000000000 R11: fffffbfff1f11dff R12: 0000000036471000
R13: ffffea0000d91c80 R14: 000000000000000b R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff888126276000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007eff6352cff8 CR3: 000000002caa2000 CR4: 00000000003526f0


---
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 syzkaller@googlegroups.com.

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 syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

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


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Forwarded: [PATCH] f2fs: DEBUG: trace node folio lifecycle to diagnose write_end_io BUG
  2026-05-14 20:19 ` [f2fs-dev] " syzbot
  (?)
@ 2026-05-14 23:35 ` syzbot
  -1 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-05-14 23:35 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] f2fs: DEBUG: trace node folio lifecycle to diagnose write_end_io BUG
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


Not for upstream. Instrumentation to identify which path leaves
a node folio with folio->index != nid_of_node(folio) at writeback
time, triggering the BUG in f2fs_write_end_io() reported by syzbot.

Adds pr_info trace points at:
  - f2fs_new_node_folio()  - in-memory node folio construction
  - __get_node_folio()     - node folio lookup (cache or read)
  - __get_node_folio()     - synchronous footer sanity failure
  - f2fs_finish_read_bio() - async read completion footer check
  - f2fs_write_end_io()    - write completion footer check

BUG_ON in f2fs_write_end_io() is intentionally retained so the
kernel halts at the failing folio and the preceding pr_info
output appears in the syzbot console log.

Link: https://syzkaller.appspot.com/bug?extid=4af46ee83100e99bce09
Not-Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 fs/f2fs/data.c | 19 ++++++++++++++-----
 fs/f2fs/node.c |  5 +++++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8d4f1e75dee3..dc01a4fe089a 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -174,10 +174,17 @@ static void f2fs_finish_read_bio(struct bio *bio, bool in_task)
 			dec_page_count(F2FS_F_SB(folio), __read_io_type(folio));
 
 		if (bio->bi_status == BLK_STS_OK &&
-			F2FS_F_SB(folio)->node_inode && is_node_folio(folio) &&
-			f2fs_sanity_check_node_footer(F2FS_F_SB(folio),
-				folio, folio->index, NODE_TYPE_REGULAR, true))
-			bio->bi_status = BLK_STS_IOERR;
+			F2FS_F_SB(folio)->node_inode && is_node_folio(folio)) {
+			int rc = f2fs_sanity_check_node_footer(F2FS_F_SB(folio),
+			                                       folio, folio->index, NODE_TYPE_REGULAR, true);
+			pr_info("f2fs-dbg: READ end_io: index=%lu footer_nid=%u ino=%u rc=%d\n",
+				folio->index,
+				nid_of_node(folio),
+				ino_of_node(folio),
+				rc);
+			if (rc)
+				bio->bi_status = BLK_STS_IOERR;
+		}
 
 		if (finished)
 			folio_end_read(folio, bio->bi_status == BLK_STS_OK);
@@ -383,8 +390,10 @@ static void f2fs_write_end_io(struct bio *bio)
 		}
 
 		if (is_node_folio(folio)) {
-			f2fs_sanity_check_node_footer(sbi, folio,
+			int rc = f2fs_sanity_check_node_footer(sbi, folio,
 				folio->index, NODE_TYPE_REGULAR, true);
+			pr_info("f2fs-dbg: WRITE end_io: index=%lu footer_nid=%u ino=%u rc=%d\n",
+			         folio->index,nid_of_node(folio),ino_of_node(folio),rc);
 			f2fs_bug_on(sbi, folio->index != nid_of_node(folio));
 		}
 		if (f2fs_in_warm_node_list(folio))
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 4e5bd9e4cfc3..12a9774ac1df 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1423,6 +1423,8 @@ struct folio *f2fs_new_node_folio(struct dnode_of_data *dn, unsigned int ofs)
 	f2fs_folio_wait_writeback(folio, NODE, true, true);
 	fill_node_footer(folio, dn->nid, dn->inode->i_ino, ofs, true);
 	set_cold_node(folio, S_ISDIR(dn->inode->i_mode));
+	pr_info("f2fs-dbg: NEW node_folio: nid=%u ino=%lu ofs=%u\n",
+		dn->nid, dn->inode->i_ino, ofs);
 	if (!folio_test_uptodate(folio))
 		folio_mark_uptodate(folio);
 	if (folio_mark_dirty(folio))
@@ -1565,6 +1567,7 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
 	struct folio *folio;
 	int err;
 
+	pr_info("f2fs-dbg: GET node_folio: nid=%lu ntype=%d\n", nid, ntype);
 	if (!nid)
 		return ERR_PTR(-ENOENT);
 	if (f2fs_check_nid_range(sbi, nid))
@@ -1603,6 +1606,8 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
 	err = f2fs_sanity_check_node_footer(sbi, folio, nid, ntype, false);
 	if (!err)
 		return folio;
+	pr_info("f2fs-dbg: SYNC sanity fail: nid=%lu footer_nid=%u ino=%u err=%d\n",
+		nid,nid_of_node(folio),ino_of_node(folio),err);
 out_err:
 	folio_clear_uptodate(folio);
 out_put_err:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [syzbot] [f2fs?] kernel BUG in f2fs_write_end_io (2)
       [not found] <20260514233543.9626-1-kartikey406@gmail.com>
@ 2026-05-15  0:07 ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-05-15  0:07 UTC (permalink / raw)
  To: kartikey406, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
kernel BUG in f2fs_write_end_io

f2fs-dbg: WRITE end_io: index=11 footer_nid=0 ino=0 rc=-117
------------[ cut here ]------------
kernel BUG at fs/f2fs/data.c:397!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 0 UID: 0 PID: 15 Comm: ksoftirqd/0 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
RIP: 0010:f2fs_write_end_io+0x193e/0x1970 fs/f2fs/data.c:397
Code: c6 e0 3c 9b 8b e8 02 e5 f6 fc 90 0f 0b e8 8a c9 93 fd 4c 89 e7 48 c7 c6 00 3e 9b 8b e8 eb e4 f6 fc 90 0f 0b e8 73 c9 93 fd 90 <0f> 0b e8 6b c9 93 fd 48 8b 3c 24 48 c7 c6 e0 3c 9b 8b e8 cb e4 f6
RSP: 0018:ffffc90000147b08 EFLAGS: 00010246
RAX: ffffffff8430cfed RBX: 0000000000001000 RCX: ffff88801cee9ec0
RDX: 0000000000000100 RSI: 0000000000000000 RDI: 0000000000000100
RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000100
R10: dffffc0000000000 R11: fffff52000028f11 R12: ffffea0000a312c0
R13: 0000000000001000 R14: 000000000000000b R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff888126174000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa3d3ae7dac CR3: 0000000037e5c000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 blk_update_request+0x57e/0xe60 block/blk-mq.c:1016
 blk_mq_end_request+0x3e/0x70 block/blk-mq.c:1178
 blk_complete_reqs block/blk-mq.c:1253 [inline]
 blk_done_softirq+0x10a/0x160 block/blk-mq.c:1258
 handle_softirqs+0x1de/0x6d0 kernel/softirq.c:622
 run_ksoftirqd+0x52/0x180 kernel/softirq.c:1076
 smpboot_thread_fn+0x541/0xa50 kernel/smpboot.c:160
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:f2fs_write_end_io+0x193e/0x1970 fs/f2fs/data.c:397
Code: c6 e0 3c 9b 8b e8 02 e5 f6 fc 90 0f 0b e8 8a c9 93 fd 4c 89 e7 48 c7 c6 00 3e 9b 8b e8 eb e4 f6 fc 90 0f 0b e8 73 c9 93 fd 90 <0f> 0b e8 6b c9 93 fd 48 8b 3c 24 48 c7 c6 e0 3c 9b 8b e8 cb e4 f6
RSP: 0018:ffffc90000147b08 EFLAGS: 00010246
RAX: ffffffff8430cfed RBX: 0000000000001000 RCX: ffff88801cee9ec0
RDX: 0000000000000100 RSI: 0000000000000000 RDI: 0000000000000100
RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000100
R10: dffffc0000000000 R11: fffff52000028f11 R12: ffffea0000a312c0
R13: 0000000000001000 R14: 000000000000000b R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff888126174000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa3d3ae7dac CR3: 0000000037e5c000 CR4: 00000000003526f0


Tested on:

commit:         66182ca8 Merge tag 'net-7.1-rc4' of git://git.kernel.o..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10c5e996580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=f2e8ebfec4636d32
dashboard link: https://syzkaller.appspot.com/bug?extid=4af46ee83100e99bce09
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1105e996580000


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Forwarded: [PATCH] f2fs: DEBUG: full lifecycle trace for node folio write-end-io BUG
  2026-05-14 20:19 ` [f2fs-dev] " syzbot
  (?)
  (?)
@ 2026-05-15  1:00 ` syzbot
  -1 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-05-15  1:00 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] f2fs: DEBUG: full lifecycle trace for node folio write-end-io BUG
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


Not for upstream. Instrumentation to identify how a node folio
with mismatched folio->index and nid_of_node(folio) reaches
f2fs_write_end_io and triggers the BUG_ON reported by syzbot.

Previous test run confirmed the read-side sanity check fires
(rc=-EFSCORRUPTED) yet the same folio still reaches writeback.
This round adds traces at every cache lifecycle event so the
leak path can be pinned down:

  - f2fs_finish_read_bio  - async read footer check, page state
  - f2fs_write_end_io     - write footer check, page state
  - f2fs_new_node_folio   - entry, after grab, after fill_footer,
                            after mark_dirty
  - read_node_folio       - entry, with current page state
  - __get_node_folio      - entry and after grab, page state
  - __get_node_folio      - sync sanity failure on page_hit

Each trace logs folio->index, footer nid/ino, and the relevant
page flags (uptodate, dirty, writeback, refcount) so the journey
of a single NID can be reconstructed across read failure, cache
reuse, and writeback submission.

BUG_ON in f2fs_write_end_io() is intentionally retained so the
kernel halts at the failing folio and the preceding trace output
appears in the syzbot console log.

Link: https://syzkaller.appspot.com/bug?extid=4af46ee83100e99bce09
Not-Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 fs/f2fs/data.c | 16 +++++++++++-----
 fs/f2fs/node.c | 19 ++++++++++++++++++-
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8d4f1e75dee3..571ba13916ef 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -174,10 +174,14 @@ static void f2fs_finish_read_bio(struct bio *bio, bool in_task)
 			dec_page_count(F2FS_F_SB(folio), __read_io_type(folio));
 
 		if (bio->bi_status == BLK_STS_OK &&
-			F2FS_F_SB(folio)->node_inode && is_node_folio(folio) &&
-			f2fs_sanity_check_node_footer(F2FS_F_SB(folio),
-				folio, folio->index, NODE_TYPE_REGULAR, true))
-			bio->bi_status = BLK_STS_IOERR;
+			F2FS_F_SB(folio)->node_inode && is_node_folio(folio)) {
+			int rc = f2fs_sanity_check_node_footer(F2FS_F_SB(folio),
+			                                       folio, folio->index, NODE_TYPE_REGULAR, true);
+			pr_info("f2fs-dbg: READ end_io: index=%lu footer_nid=%u ino=%u uptodate=%d dirty=%d rc=%d\n",
+				folio->index,nid_of_node(folio),ino_of_node(folio),folio_test_uptodate(folio),folio_test_dirty(folio),rc);
+			if (rc)
+				bio->bi_status = BLK_STS_IOERR;
+		}
 
 		if (finished)
 			folio_end_read(folio, bio->bi_status == BLK_STS_OK);
@@ -383,8 +387,10 @@ static void f2fs_write_end_io(struct bio *bio)
 		}
 
 		if (is_node_folio(folio)) {
-			f2fs_sanity_check_node_footer(sbi, folio,
+			int rc = f2fs_sanity_check_node_footer(sbi, folio,
 				folio->index, NODE_TYPE_REGULAR, true);
+			pr_info("f2fs-dbg: WRITE end_io: index=%lu footer_nid=%u ino=%u uptodate=%d dirty=%d rc=%d\n",
+				folio->index,nid_of_node(folio),ino_of_node(folio),folio_test_uptodate(folio),folio_test_dirty(folio),rc);
 			f2fs_bug_on(sbi, folio->index != nid_of_node(folio));
 		}
 		if (f2fs_in_warm_node_list(folio))
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 4e5bd9e4cfc3..d38b32fe7ee9 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1384,6 +1384,8 @@ struct folio *f2fs_new_node_folio(struct dnode_of_data *dn, unsigned int ofs)
 	struct folio *folio;
 	int err;
 
+	pr_info("f2fs-dbg: NEW entry: nid=%u ino=%lu ofs=%u\n",
+		dn->nid, dn->inode->i_ino, ofs);
 	if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC)))
 		return ERR_PTR(-EPERM);
 
@@ -1391,6 +1393,8 @@ struct folio *f2fs_new_node_folio(struct dnode_of_data *dn, unsigned int ofs)
 	if (IS_ERR(folio))
 		return folio;
 
+	pr_info("f2fs-dbg: NEW grabbed: nid=%u uptodate=%d dirty=%d writeback=%d refcount=%d\n",
+		dn->nid,folio_test_uptodate(folio),folio_test_dirty(folio),folio_test_writeback(folio),folio_ref_count(folio));
 	if (unlikely((err = inc_valid_node_count(sbi, dn->inode, !ofs))))
 		goto fail;
 
@@ -1423,10 +1427,14 @@ struct folio *f2fs_new_node_folio(struct dnode_of_data *dn, unsigned int ofs)
 	f2fs_folio_wait_writeback(folio, NODE, true, true);
 	fill_node_footer(folio, dn->nid, dn->inode->i_ino, ofs, true);
 	set_cold_node(folio, S_ISDIR(dn->inode->i_mode));
+	pr_info("f2fs-dbg: NEW after fill_footer: nid=%u footer_nid=%u footer_ino=%u\n",
+		dn->nid, nid_of_node(folio), ino_of_node(folio));
 	if (!folio_test_uptodate(folio))
 		folio_mark_uptodate(folio);
-	if (folio_mark_dirty(folio))
+	if (folio_mark_dirty(folio)) {
+		pr_info("f2fs-dbg: NEW marked dirty: nid=%u\n", dn->nid);
 		dn->node_changed = true;
+	}
 
 	if (f2fs_has_xattr_block(ofs))
 		f2fs_i_xnid_write(dn->inode, dn->nid);
@@ -1459,6 +1467,10 @@ static int read_node_folio(struct folio *folio, blk_opf_t op_flags)
 	};
 	int err;
 
+	 pr_info("f2fs-dbg: read_node_folio entry: index=%lu uptodate=%d dirty=%d\n",
+            folio->index,
+            folio_test_uptodate(folio),
+            folio_test_dirty(folio));
 	if (folio_test_uptodate(folio)) {
 		if (!f2fs_inode_chksum_verify(sbi, folio)) {
 			folio_clear_uptodate(folio);
@@ -1565,6 +1577,7 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
 	struct folio *folio;
 	int err;
 
+	pr_info("f2fs-dbg: GET node_folio: nid=%lu ntype=%d\n", nid, ntype);
 	if (!nid)
 		return ERR_PTR(-ENOENT);
 	if (f2fs_check_nid_range(sbi, nid))
@@ -1574,6 +1587,8 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
 	if (IS_ERR(folio))
 		return folio;
 
+	pr_info("f2fs-dbg: GET grabbed: nid=%lu uptodate=%d dirty=%d writeback=%d refcount=%d\n",
+		nid,folio_test_uptodate(folio),folio_test_dirty(folio),folio_test_writeback(folio),folio_ref_count(folio));
 	err = read_node_folio(folio, 0);
 	if (err < 0)
 		goto out_put_err;
@@ -1603,6 +1618,8 @@ static struct folio *__get_node_folio(struct f2fs_sb_info *sbi, pgoff_t nid,
 	err = f2fs_sanity_check_node_footer(sbi, folio, nid, ntype, false);
 	if (!err)
 		return folio;
+	pr_info("f2fs-dbg: SYNC sanity fail: nid=%lu footer_nid=%u ino=%u err=%d\n",
+		nid,nid_of_node(folio),ino_of_node(folio),err);
 out_err:
 	folio_clear_uptodate(folio);
 out_put_err:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-15  1:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 20:19 [syzbot] [f2fs?] kernel BUG in f2fs_write_end_io (2) syzbot
2026-05-14 20:19 ` [f2fs-dev] " syzbot
2026-05-14 23:35 ` Forwarded: [PATCH] f2fs: DEBUG: trace node folio lifecycle to diagnose write_end_io BUG syzbot
2026-05-15  1:00 ` Forwarded: [PATCH] f2fs: DEBUG: full lifecycle trace for node folio write-end-io BUG syzbot
     [not found] <20260514233543.9626-1-kartikey406@gmail.com>
2026-05-15  0:07 ` [syzbot] [f2fs?] kernel BUG in f2fs_write_end_io (2) syzbot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.