[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <94cab214-3581-ff53-97bb-9382a7c599ea@huawei.com>
Date: Sat, 7 Jan 2023 17:28:54 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: Jan Kara <jack@...e.cz>
CC: <tytso@....edu>, <jack@...e.com>, <linux-ext4@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <yi.zhang@...wei.com>,
<libaokun1@...wei.com>, <zhanchengbin1@...wei.com>,
<yangerkun@...wei.com>
Subject: Re: [PATCH] [RFC] Fix data missing when reusing bh which is ready to
be checkpointed
在 2022/12/21 18:13, Jan Kara 写道:
> On Tue 20-12-22 23:05:51, Zhihao Cheng wrote:
>> From: zhanchengbin <zhanchengbin1@...wei.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
Powered by blists - more mailing lists