On Tue, 10 Jan 2023 09:53:27 +0800, Zhihao Cheng wrote: > 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. > > [...] Applied, thanks! [1/1] jbd2: Fix data missing when reusing bh which is ready to be checkpointed commit: e6b9bd7290d334451ce054e98e752abc055e0034 Best regards, -- Theodore Ts'o <tytso@xxxxxxx>