mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Jan Kara <jack@suse.cz>
Cc: <tytso@mit.edu>, <jack@suse.com>, <linux-ext4@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <yi.zhang@huawei.com>,
	<libaokun1@huawei.com>, <zhanchengbin1@huawei.com>,
	<yangerkun@huawei.com>
Subject: Re: [PATCH] [RFC] Fix data missing when reusing bh which is ready to be checkpointed
Date: Sat, 7 Jan 2023 17:28:54 +0800	[thread overview]
Message-ID: <94cab214-3581-ff53-97bb-9382a7c599ea@huawei.com> (raw)
In-Reply-To: <20221221101344.mup3mmrlt5c7yjfv@quack3>

在 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



      reply	other threads:[~2023-01-07  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20 15:05 Zhihao Cheng
2022-12-21 10:13 ` Jan Kara
2023-01-07  9:28   ` Zhihao Cheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94cab214-3581-ff53-97bb-9382a7c599ea@huawei.com \
    --to=chengzhihao1@huawei.com \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=libaokun1@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=zhanchengbin1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®