> From eb6567de576ac4a9337c3971a2d0549af64e15f0 Mon Sep 17 00:00:00 2001 > From: dingdinghua <dingdinghua@xxxxxxxxxxxx> > Date: Sat, 30 Jan 2010 14:23:28 +0800 > Subject: [PATCH] Jbd2: delay discarding buffers in journal_unmap_buffer > > We should delay discarding buffers until we know that "add to orphan" > operation has definitely been committed, otherwise the log space of > committing transation may be freed and reused before truncate get > committed, updates may get lost if crash happens. Thanks for the patch. For us to be able to merge the patch, we need a Signed-off-by signature from you. Please add it in the next round of submission. > diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c > index 1bc74b6..c5d1c7c 100644 > --- a/fs/jbd2/commit.c > +++ b/fs/jbd2/commit.c > @@ -936,8 +936,10 @@ restart_loop: > * behind for writeback and gets reallocated for another > * use in a different page. */ > if (buffer_freed(bh)) { > - clear_buffer_freed(bh); > - clear_buffer_jbddirty(bh); > + if (!jh->b_next_transaction) { > + clear_buffer_freed(bh); > + clear_buffer_jbddirty(bh); > + } > } When can merge the 'if' here. Also the comment above this code needs updating after your change. > if (buffer_jbddirty(bh)) { > diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c > index a051270..0d019f1 100644 > --- a/fs/jbd2/transaction.c > +++ b/fs/jbd2/transaction.c > @@ -1788,11 +1788,8 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) > * running transaction if that is set, but nothing > * else. */ > set_buffer_freed(bh); > - if (jh->b_next_transaction) { > - J_ASSERT(jh->b_next_transaction == > - journal->j_running_transaction); > - jh->b_next_transaction = NULL; > - } > + if (journal->j_running_transaction && buffer_jbddirty(bh)) > + jh->b_next_transaction = journal->j_running_transaction; Also here you have to update the comment above set_buffer_freed to match the new reality. Otherwise I'm fine with the patch. Honza -- Jan Kara <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html