diff options
-rw-r--r-- | fs/jbd/commit.c | 21 | ||||
-rw-r--r-- | fs/jbd/transaction.c | 3 |
2 files changed, 18 insertions, 6 deletions
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 002ad2bbc769..0971814c38b8 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -790,11 +790,22 @@ restart_loop: | |||
790 | jbd_unlock_bh_state(bh); | 790 | jbd_unlock_bh_state(bh); |
791 | } else { | 791 | } else { |
792 | J_ASSERT_BH(bh, !buffer_dirty(bh)); | 792 | J_ASSERT_BH(bh, !buffer_dirty(bh)); |
793 | J_ASSERT_JH(jh, jh->b_next_transaction == NULL); | 793 | /* The buffer on BJ_Forget list and not jbddirty means |
794 | __journal_unfile_buffer(jh); | 794 | * it has been freed by this transaction and hence it |
795 | jbd_unlock_bh_state(bh); | 795 | * could not have been reallocated until this |
796 | journal_remove_journal_head(bh); /* needs a brelse */ | 796 | * transaction has committed. *BUT* it could be |
797 | release_buffer_page(bh); | 797 | * reallocated once we have written all the data to |
798 | * disk and before we process the buffer on BJ_Forget | ||
799 | * list. */ | ||
800 | JBUFFER_TRACE(jh, "refile or unfile freed buffer"); | ||
801 | __journal_refile_buffer(jh); | ||
802 | if (!jh->b_transaction) { | ||
803 | jbd_unlock_bh_state(bh); | ||
804 | /* needs a brelse */ | ||
805 | journal_remove_journal_head(bh); | ||
806 | release_buffer_page(bh); | ||
807 | } else | ||
808 | jbd_unlock_bh_state(bh); | ||
798 | } | 809 | } |
799 | cond_resched_lock(&journal->j_list_lock); | 810 | cond_resched_lock(&journal->j_list_lock); |
800 | } | 811 | } |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index c609f5034fcd..ff75afe9b185 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -2038,7 +2038,8 @@ void __journal_refile_buffer(struct journal_head *jh) | |||
2038 | __journal_temp_unlink_buffer(jh); | 2038 | __journal_temp_unlink_buffer(jh); |
2039 | jh->b_transaction = jh->b_next_transaction; | 2039 | jh->b_transaction = jh->b_next_transaction; |
2040 | jh->b_next_transaction = NULL; | 2040 | jh->b_next_transaction = NULL; |
2041 | __journal_file_buffer(jh, jh->b_transaction, BJ_Metadata); | 2041 | __journal_file_buffer(jh, jh->b_transaction, |
2042 | was_dirty ? BJ_Metadata : BJ_Reserved); | ||
2042 | J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); | 2043 | J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); |
2043 | 2044 | ||
2044 | if (was_dirty) | 2045 | if (was_dirty) |