Bug 216251

Summary: kernel BUG at fs/jbd2/transaction.c:1629
Product: File System Reporter: Zhihao Cheng (chengzhihao1)
Component: ext4Assignee: fs_ext4 (fs_ext4)
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.19-rc6 Subsystem:
Regression: No Bisected commit-id:
Attachments: a.c
delay_diff

Description Zhihao Cheng 2022-07-15 11:58:45 UTC
[  227.908690] ------------[ cut here ]------------
[  227.909523] kernel BUG at fs/jbd2/transaction.c:1629!
[  227.910466] invalid opcode: 0000 [#1] PREEMPT SMP
[  227.911306] CPU: 2 PID: 584 Comm: unlink Tainted: G        W         5.19.0-rc6-00115-g4a57a8400075-dirty #697
[  227.913010] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.f4
[  227.915264] RIP: 0010:jbd2_journal_dirty_metadata+0x3c5/0x470
[  227.916286] Code: 44 24 10 48 83 05 2a 15 97 0b 01 41 83 f8 01 0f 85 89 78 9f 00 48 83 05 30 15 97 0b 01 e9 32 ff ff ff 48 83 05 eb 154
[  227.918779] RSP: 0018:ffffc90000be7ce0 EFLAGS: 00010202
[  227.919284] RAX: 0000000001116019 RBX: ffff8881027df000 RCX: ffff88817d11c000
[  227.919967] RDX: 0000000000000018 RSI: ffffffff82c73015 RDI: 0000000000000000
[  227.920653] RBP: ffff888101852270 R08: 0000000000000000 R09: ffffc90000be7b70
[  227.921331] R10: 0000000000000001 R11: 0000000000000001 R12: ffff88810185f258
[  227.922015] R13: 0000000000000000 R14: ffff88810185f260 R15: ffff88817d11c000
[  227.922705] FS:  00007fa2fbc564c0(0000) GS:ffff888237c80000(0000) knlGS:0000000000000000
[  227.923472] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  227.924031] CR2: 000055623fe24008 CR3: 000000017c264000 CR4: 00000000000006e0
[  227.924725] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  227.925408] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  227.926086] Call Trace:
[  227.926339]  <TASK>
[  227.926558]  __ext4_handle_dirty_metadata+0xa0/0x290
[  227.927042]  ext4_handle_dirty_dirblock+0x10c/0x1d0
[  227.927515]  ext4_delete_entry+0x104/0x200
[  227.927912]  __ext4_unlink+0x22b/0x360
[  227.928276]  ? __ext4_journal_start_sb+0x1af/0x1f0
[  227.928745]  ext4_unlink+0x275/0x390
[  227.929097]  vfs_unlink+0x20b/0x4c0
[  227.929439]  do_unlinkat+0x42f/0x4c0
[  227.929792]  __x64_sys_unlink+0x37/0x50
[  227.930159]  do_syscall_64+0x35/0x80
Comment 1 Zhihao Cheng 2022-07-15 11:58:59 UTC
Created attachment 301436 [details]
a.c
Comment 2 Zhihao Cheng 2022-07-15 11:59:13 UTC
Created attachment 301437 [details]
delay_diff
Comment 3 Zhihao Cheng 2022-07-15 12:01:22 UTC
Find an environment with xfs(actually, no ext4 is okay) rootfs.

1. Apply delay_diff to linux kernel source and make kernel image
2. Run kernel, compile and run a.c

[  225.700954] ext4 filesystem being mounted at /root/temp supports timestamps until 2038 (0x7fffffff)
[  225.789487] jbd2_journal_dirty_metadata: set jh ffff88810185f258 BJ_Metadata, trans ffff8881027e0100
[  225.791319] jbd2_journal_dirty_metadata: set jh ffff88810185f168 BJ_Metadata, trans ffff8881027e0100
[  225.825894] jbd2_journal_commit_transaction: wait process jh ffff88810185f258 in trans ffff8881027e0100
[  226.812338] do_get_write_access: set jh ffff88810185f258 frozen data, trans ffff8881027e0100
[  226.813643] jbd2_journal_dirty_metadata: jh ffff88810185f258 trans ffff8881027e0100 wait trans changed
[  227.801122] EXT4-fs (sda): shut down requested (2)
[  227.802322] Aborting journal on device sda-8.
[  227.826759] abort journal
[  227.905176] jbd2_journal_commit_transaction: wait done process jh ffff88810185f258 in trans ffff8881027e0100
[  227.906940] jbd2_journal_dirty_metadata: jh ffff88810185f258 trans ffff88817d11c000 wait done trans changed
[  227.908690] ------------[ cut here ]------------
[  227.909523] kernel BUG at fs/jbd2/transaction.c:1629!
[  227.910466] invalid opcode: 0000 [#1] PREEMPT SMP
[  227.911306] CPU: 2 PID: 584 Comm: unlink Tainted: G        W         5.19.0-rc6-00115-g4a57a8400075-dirty #697
[  227.913010] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.f4
[  227.915264] RIP: 0010:jbd2_journal_dirty_metadata+0x3c5/0x470
[  227.916286] Code: 44 24 10 48 83 05 2a 15 97 0b 01 41 83 f8 01 0f 85 89 78 9f 00 48 83 05 30 15 97 0b 01 e9 32 ff ff ff 48 83 05 eb 154
[  227.918779] RSP: 0018:ffffc90000be7ce0 EFLAGS: 00010202
[  227.919284] RAX: 0000000001116019 RBX: ffff8881027df000 RCX: ffff88817d11c000
[  227.919967] RDX: 0000000000000018 RSI: ffffffff82c73015 RDI: 0000000000000000
[  227.920653] RBP: ffff888101852270 R08: 0000000000000000 R09: ffffc90000be7b70
[  227.921331] R10: 0000000000000001 R11: 0000000000000001 R12: ffff88810185f258
[  227.922015] R13: 0000000000000000 R14: ffff88810185f260 R15: ffff88817d11c000
[  227.922705] FS:  00007fa2fbc564c0(0000) GS:ffff888237c80000(0000) knlGS:0000000000000000
[  227.923472] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  227.924031] CR2: 000055623fe24008 CR3: 000000017c264000 CR4: 00000000000006e0
[  227.924725] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  227.925408] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  227.926086] Call Trace:
[  227.926339]  <TASK>
[  227.926558]  __ext4_handle_dirty_metadata+0xa0/0x290
[  227.927042]  ext4_handle_dirty_dirblock+0x10c/0x1d0
[  227.927515]  ext4_delete_entry+0x104/0x200
[  227.927912]  __ext4_unlink+0x22b/0x360
[  227.928276]  ? __ext4_journal_start_sb+0x1af/0x1f0
[  227.928745]  ext4_unlink+0x275/0x390
[  227.929097]  vfs_unlink+0x20b/0x4c0
[  227.929439]  do_unlinkat+0x42f/0x4c0
[  227.929792]  __x64_sys_unlink+0x37/0x50
[  227.930159]  do_syscall_64+0x35/0x80
[  227.930514]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[  227.931009] RIP: 0033:0x7fa2fb701b77
[  227.931369] Code: f0 ff ff 73 01 c3 48 8b 0d 0e d3 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 57 00 008
[  227.933120] RSP: 002b:00007ffce6ef4f28 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
[  227.933826] RAX: ffffffffffffffda RBX: 00007ffce6ef5028 RCX: 00007fa2fb701b77
[  227.934485] RDX: 0000000000000001 RSI: 0000000000000002 RDI: 00007ffce6ef5537
[  227.935150] RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
[  227.935822] R10: fffffffffffff40d R11: 0000000000000246 R12: 00007fa2fb9cf1e4
[  227.936480] R13: 00007ffce6ef5020 R14: 0000000000000000 R15: 0000000000000000
[  227.937158]  </TASK>
[  227.937380] Modules linked in:
[  227.937706] ---[ end trace 0000000000000000 ]---