Re: [PATCH] [RFC] Fix data missing when reusing bh which is ready to be checkpointed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 2022/12/21 18:13, Jan Kara 写道:
On Tue 20-12-22 23:05:51, Zhihao Cheng wrote:
From: zhanchengbin <zhanchengbin1@xxxxxxxxxx>

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





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux