lkml.org 
[lkml]   [2023]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] [RFC] Fix data missing when reusing bh which is ready to be checkpointed
From
Date
在 2022/12/21 18:13, Jan Kara 写道:
> On Tue 20-12-22 23:05:51, Zhihao Cheng wrote:
>> From: zhanchengbin <zhanchengbin1@huawei.com>
>>
>> Following process will make data lost and could lead to a filesystem
>> corrupted problem:
>>
>> 1. jh(bh) is inserted into T1->t_checkpoint_list, bh is dirty, and
>> jh->b_transaction = NULL
>> 2. T1 is added into journal->j_checkpoint_transactions.
>> 3. Get bh prepare to write while doing checkpoing:
>> PA PB
>> do_get_write_access jbd2_log_do_checkpoint
>> spin_lock(&jh->b_state_lock)
>> if (buffer_dirty(bh))
>> clear_buffer_dirty(bh) // clear buffer dirty
>> set_buffer_jbddirty(bh)
>> transaction =
>> journal->j_checkpoint_transactions
>> jh = transaction->t_checkpoint_list
>> if (!buffer_dirty(bh))
>> __jbd2_journal_remove_checkpoint(jh)
>> // bh won't be flushed
>> jbd2_cleanup_journal_tail
>> __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved)
>> 4. Aborting journal/Power-cut before writing latest bh on journal area.

[...]
>>
>> fs/jbd2/transaction.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> Good catch! Did you find it by code inspection or were you able to actually
> trigger this problem?

By code inspection.
Reproducer: https://bugzilla.kernel.org/show_bug.cgi?id=216898


\
 
 \ /
  Last update: 2023-03-26 23:31    [W:0.040 / U:3.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site