Zhihao Cheng
6073389db8
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-25 11:15:19 +02:00
..
2022-06-25 11:48:57 +02:00
2019-08-06 19:06:49 +02:00
2021-03-04 09:39:55 +01:00
2022-07-02 16:27:33 +02:00
2019-12-13 08:51:01 +01:00
2018-12-01 09:37:27 +01:00
2022-06-14 16:59:14 +02:00
2020-11-05 11:08:54 +01:00
2022-06-14 16:59:38 +02:00
2022-06-14 16:59:38 +02:00
2019-08-06 19:06:51 +02:00
2022-03-02 11:38:13 +01:00
2018-11-13 11:08:55 -08:00
2021-09-22 11:47:56 +02:00
2019-05-08 07:21:48 +02:00
2019-03-23 20:09:59 +01:00
2022-07-29 17:10:35 +02:00
2021-05-26 11:48:34 +02:00
2020-12-02 08:48:12 +01:00
2019-12-05 09:20:32 +01:00
2020-01-27 14:50:02 +01:00
2022-08-25 11:14:58 +02:00
2022-08-25 11:15:19 +02:00
2022-06-14 16:59:26 +02:00
2022-06-14 16:59:18 +02:00
2021-09-22 11:48:02 +02:00
2022-08-25 11:14:55 +02:00
2022-05-18 09:42:48 +02:00
2021-07-31 08:22:38 +02:00
2021-05-22 10:59:45 +02:00
2021-06-03 08:38:12 +02:00
2021-11-12 14:40:50 +01:00
2022-08-25 11:15:19 +02:00
2022-06-14 16:59:33 +02:00
2022-06-14 16:59:17 +02:00
2022-06-14 16:59:37 +02:00
2020-12-30 11:25:59 +01:00
2022-04-15 14:15:03 +02:00
2022-06-25 11:49:15 +02:00
2020-12-30 11:26:02 +01:00
2022-06-06 08:24:22 +02:00
2022-07-21 21:09:26 +02:00
2022-06-14 16:59:20 +02:00
2022-08-11 12:48:38 +02:00
2022-06-14 16:59:28 +02:00
2022-01-27 09:04:13 +01:00
2022-08-25 11:14:54 +02:00
2022-06-14 16:59:25 +02:00
2021-03-04 09:39:54 +01:00
2021-10-06 15:31:20 +02:00
2022-02-23 11:58:38 +01:00
2020-10-30 10:38:21 +01:00
2021-08-12 13:19:44 +02:00
2020-08-26 10:30:59 +02:00
2021-05-22 10:59:45 +02:00
2022-03-23 09:10:42 +01:00
2018-12-17 09:24:30 +01:00
2022-03-02 11:38:17 +01:00
2022-04-15 14:15:00 +02:00
2022-02-08 18:23:03 +01:00
2020-08-21 11:05:38 +02:00
2022-07-12 16:29:02 +02:00
2021-12-14 10:18:07 +01:00
2022-08-25 11:14:53 +02:00
2021-10-06 15:31:24 +02:00
2022-06-14 16:59:13 +02:00
2021-03-17 16:43:51 +01:00
2019-11-06 13:05:37 +01:00
2021-05-22 10:59:49 +02:00
2020-11-05 11:08:46 +01:00
2020-01-14 20:06:57 +01:00
2020-01-09 10:19:07 +01:00
2020-05-14 07:57:21 +02:00
2022-06-14 16:59:24 +02:00
2020-11-05 11:08:35 +01:00
2021-04-14 08:22:32 +02:00
2020-01-12 12:17:20 +01:00
2020-02-11 04:34:08 -08:00
2020-10-07 08:00:09 +02:00
2022-06-06 08:24:21 +02:00
2021-09-22 11:47:50 +02:00
2021-12-08 08:50:13 +01:00
2022-03-02 11:38:15 +01:00
2020-04-17 10:48:51 +02:00
2022-06-14 16:59:27 +02:00
2020-03-25 08:06:14 +01:00
2019-05-31 06:46:05 -07:00
2018-11-21 09:19:14 +01:00
2021-05-22 10:59:50 +02:00
2020-11-24 13:27:23 +01:00
2020-01-09 10:19:00 +01:00
2022-08-25 11:14:53 +02:00
2022-05-15 19:41:59 +02:00
2019-05-25 18:23:26 +02:00
2020-03-18 07:14:21 +01:00
2021-08-12 13:19:43 +02:00
2020-05-02 17:26:01 +02:00
2019-12-01 09:17:04 +01:00
2021-04-28 13:16:50 +02:00
2022-01-29 10:19:18 +01:00
2021-07-20 16:16:16 +02:00
2021-12-14 10:18:07 +01:00
2022-08-25 11:15:08 +02:00
2022-04-27 13:39:44 +02:00
2019-10-11 18:21:39 +02:00
2022-02-23 11:58:38 +01:00
2021-09-22 11:48:02 +02:00
2020-08-11 15:32:34 +02:00