From 45e1ac2fdeb90afc0d8677ea441dbd8a308b5c52 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Fri, 23 Jun 2006 02:05:25 -0700 Subject: [PATCH] --- yaml --- r: 29045 b: refs/heads/master c: 9ada7340987aa24395809570840c7c6847044f52 h: refs/heads/master i: 29043: 1ce47239911d42c7e977caeab790eb0aeec22d24 v: v3 --- [refs] | 2 +- trunk/fs/jbd/commit.c | 21 ++++++++++++++++----- trunk/fs/jbd/transaction.c | 3 ++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 7bcb4e738da5..29c7f02b6ad1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8e0a43d8fa953179505869ec28de78550246e795 +refs/heads/master: 9ada7340987aa24395809570840c7c6847044f52 diff --git a/trunk/fs/jbd/commit.c b/trunk/fs/jbd/commit.c index 002ad2bbc769..0971814c38b8 100644 --- a/trunk/fs/jbd/commit.c +++ b/trunk/fs/jbd/commit.c @@ -790,11 +790,22 @@ void journal_commit_transaction(journal_t *journal) jbd_unlock_bh_state(bh); } else { J_ASSERT_BH(bh, !buffer_dirty(bh)); - J_ASSERT_JH(jh, jh->b_next_transaction == NULL); - __journal_unfile_buffer(jh); - jbd_unlock_bh_state(bh); - journal_remove_journal_head(bh); /* needs a brelse */ - release_buffer_page(bh); + /* The buffer on BJ_Forget list and not jbddirty means + * it has been freed by this transaction and hence it + * could not have been reallocated until this + * transaction has committed. *BUT* it could be + * reallocated once we have written all the data to + * disk and before we process the buffer on BJ_Forget + * list. */ + JBUFFER_TRACE(jh, "refile or unfile freed buffer"); + __journal_refile_buffer(jh); + if (!jh->b_transaction) { + jbd_unlock_bh_state(bh); + /* needs a brelse */ + journal_remove_journal_head(bh); + release_buffer_page(bh); + } else + jbd_unlock_bh_state(bh); } cond_resched_lock(&journal->j_list_lock); } diff --git a/trunk/fs/jbd/transaction.c b/trunk/fs/jbd/transaction.c index c609f5034fcd..ff75afe9b185 100644 --- a/trunk/fs/jbd/transaction.c +++ b/trunk/fs/jbd/transaction.c @@ -2038,7 +2038,8 @@ void __journal_refile_buffer(struct journal_head *jh) __journal_temp_unlink_buffer(jh); jh->b_transaction = jh->b_next_transaction; jh->b_next_transaction = NULL; - __journal_file_buffer(jh, jh->b_transaction, BJ_Metadata); + __journal_file_buffer(jh, jh->b_transaction, + was_dirty ? BJ_Metadata : BJ_Reserved); J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); if (was_dirty)