Zhihao Cheng
ddd896792e
jbd2: fix assertion 'jh->b_frozen_data == NULL' failure when journal aborted
...
[ Upstream commit 4a734f0869f970b8a9b65062ea40b09a5da9dba8 ]
Following process will fail assertion 'jh->b_frozen_data == NULL' in
jbd2_journal_dirty_metadata():
jbd2_journal_commit_transaction
unlink(dir/a)
jh->b_transaction = trans1
jh->b_jlist = BJ_Metadata
journal->j_running_transaction = NULL
trans1->t_state = T_COMMIT
unlink(dir/b)
handle->h_trans = trans2
do_get_write_access
jh->b_modified = 0
jh->b_frozen_data = frozen_buffer
jh->b_next_transaction = trans2
jbd2_journal_dirty_metadata
is_handle_aborted
is_journal_aborted // return false
--> jbd2 abort <--
while (commit_transaction->t_buffers)
if (is_journal_aborted)
jbd2_journal_refile_buffer
__jbd2_journal_refile_buffer
WRITE_ONCE(jh->b_transaction,
jh->b_next_transaction)
WRITE_ONCE(jh->b_next_transaction, NULL)
__jbd2_journal_file_buffer(jh, BJ_Reserved)
J_ASSERT_JH(jh, jh->b_frozen_data == NULL) // assertion failure !
The reproducer (See detail in [Link]) reports:
------------[ cut here ]------------
kernel BUG at fs/jbd2/transaction.c:1629!
invalid opcode: 0000 [#1 ] PREEMPT SMP
CPU: 2 PID: 584 Comm: unlink Tainted: G W
5.19.0-rc6-00115-g4a57a8400075-dirty #697
RIP: 0010:jbd2_journal_dirty_metadata+0x3c5/0x470
RSP: 0018:ffffc90000be7ce0 EFLAGS: 00010202
Call Trace:
<TASK>
__ext4_handle_dirty_metadata+0xa0/0x290
ext4_handle_dirty_dirblock+0x10c/0x1d0
ext4_delete_entry+0x104/0x200
__ext4_unlink+0x22b/0x360
ext4_unlink+0x275/0x390
vfs_unlink+0x20b/0x4c0
do_unlinkat+0x42f/0x4c0
__x64_sys_unlink+0x37/0x50
do_syscall_64+0x35/0x80
After journal aborting, __jbd2_journal_refile_buffer() is executed with
holding @jh->b_state_lock, we can fix it by moving 'is_handle_aborted()'
into the area protected by @jh->b_state_lock.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216251
Fixes: 470decc613ab20 ("[PATCH] jbd2: initial copy of files from jbd")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Link: https://lore.kernel.org/r/20220715125152.4022726-1-chengzhihao1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-17 15:15:43 +02:00
..
2022-06-17 06:03:30 +09:00
2022-05-09 16:21:44 -04:00
2022-05-09 16:21:44 -04:00
2022-07-14 10:10:12 +02:00
2022-05-09 16:21:45 -04:00
2022-05-09 16:21:44 -04:00
2022-08-17 15:14:54 +02:00
2022-07-05 16:12:21 +01:00
2022-07-14 10:10:12 +02:00
2022-07-13 19:59:47 -05:00
2022-05-09 16:21:45 -04:00
2022-02-22 18:30:28 +01:00
2022-05-09 16:21:45 -04:00
2022-05-09 16:18:54 -07:00
2022-02-25 11:56:13 +01:00
2022-01-24 14:17:02 +01:00
2022-05-02 11:23:49 -05:00
2022-05-09 16:21:45 -04:00
2022-05-09 16:21:45 -04:00
2022-08-17 15:14:21 +02:00
2022-06-09 21:26:32 +09:00
2022-04-28 16:31:10 +02:00
2022-08-17 15:14:00 +02:00
2022-08-17 15:15:43 +02:00
2022-06-21 08:29:56 -07:00
2022-05-27 11:22:03 -07:00
2022-06-03 10:34:34 -07:00
2022-07-05 16:12:55 +01:00
2022-08-17 15:13:55 +02:00
2022-05-24 19:55:07 -07:00
2022-05-09 23:12:34 -04:00
2022-05-09 23:12:34 -04:00
2022-05-09 16:21:45 -04:00
2022-05-09 16:21:45 -04:00
2022-06-16 19:11:32 -07:00
2022-05-24 19:55:07 -07:00
2022-05-09 16:21:45 -04:00
2022-08-17 15:15:43 +02:00
2022-06-03 14:42:24 -07:00
2022-05-27 15:59:21 -07:00
2022-08-17 15:15:26 +02:00
2022-08-17 15:13:54 +02:00
2022-08-17 15:13:42 +02:00
2022-05-09 16:21:44 -04:00
2022-07-14 10:10:12 +02:00
2022-08-17 15:13:40 +02:00
2022-08-17 15:13:40 +02:00
2022-07-03 15:42:33 -07:00
2022-06-28 11:18:13 +02:00
2022-07-18 15:07:52 -07:00
2022-06-03 16:57:16 -07:00
2022-07-18 15:09:15 -07:00
2022-05-09 16:21:44 -04:00
2022-03-22 15:57:03 -07:00
2022-05-09 23:12:53 -04:00
2022-08-17 15:13:48 +02:00
2022-05-27 11:22:03 -07:00
2022-03-15 11:08:23 -07:00
2022-05-09 16:21:44 -04:00
2022-05-09 16:21:44 -04:00
2022-06-06 10:08:10 +02:00
2021-11-09 10:11:53 -08:00
2022-05-09 23:12:34 -04:00
2022-05-09 16:21:46 -04:00
2022-05-23 20:24:12 -05:00
2022-05-24 19:55:07 -07:00
2022-04-05 15:39:19 +02:00
2022-05-27 11:22:03 -07:00
2022-06-17 19:01:28 -04:00
2022-06-03 14:42:24 -07:00
2022-05-24 19:55:07 -07:00
2022-05-09 16:21:44 -04:00
2022-02-14 10:37:32 +09:00
2022-05-09 16:21:46 -04:00
2022-05-24 19:55:07 -07:00
2022-07-01 09:09:52 -07:00
2022-06-08 19:13:55 +09:00
2022-04-01 19:57:03 -07:00
2022-08-17 15:13:46 +02:00
2022-03-08 12:55:29 -06:00
2022-03-03 20:38:56 -08:00
2022-04-15 14:49:56 -07:00
2022-04-22 10:57:18 -07:00
2022-02-09 09:50:02 -08:00
2022-05-09 23:12:34 -04:00
2022-03-03 20:38:56 -08:00
2022-03-28 17:29:53 -07:00
2021-11-06 13:30:32 -07:00
2022-05-27 15:49:30 -07:00
2022-03-22 15:57:03 -07:00
2022-04-17 19:50:02 -06:00
2022-08-17 15:13:59 +02:00
2022-07-11 09:52:59 -07:00
2022-05-09 18:20:49 -07:00
2022-06-04 18:52:00 -07:00
2022-06-05 15:03:03 -04:00
2022-01-18 09:23:19 +02:00
2021-12-09 14:09:36 -05:00
2022-06-06 09:54:30 +02:00
2022-05-19 23:25:10 -04:00
2022-06-06 09:54:30 +02:00
2022-06-04 19:00:05 -07:00
2022-04-01 19:35:56 -07:00
2022-04-28 23:16:15 -07:00
2022-05-30 10:56:18 -07:00
2022-05-09 16:21:44 -04:00
2022-05-19 12:25:39 -04:00
2022-08-17 15:14:20 +02:00
2022-08-17 15:13:56 +02:00
2022-05-09 23:12:34 -04:00
2022-08-17 15:13:47 +02:00
2022-06-04 19:00:05 -07:00
2022-05-31 14:10:54 -07:00
2022-05-27 11:22:03 -07:00
2022-04-19 10:19:02 -07:00
2021-12-03 18:44:06 +01:00
2022-07-26 19:38:46 -07:00
2022-07-14 15:35:24 -07:00
2022-01-11 09:03:05 -08:00
2022-05-22 21:03:01 +01:00
2022-01-17 05:49:30 +02:00
2022-08-17 15:14:49 +02:00
2022-05-31 14:10:54 -07:00
2022-04-17 19:49:59 -06:00
2022-04-26 13:36:25 -07:00
2022-01-22 08:33:36 +02:00
2022-07-26 18:25:01 -07:00
2022-04-24 18:18:37 -06:00