Skip to content

Commit

Permalink
jbd2: check jh->b_transaction without taking j_list_lock
Browse files Browse the repository at this point in the history
jh->b_transaction is adequately protected for reading by the
jbd_lock_bh_state(bh), so we don't need to take j_list_lock in
__journal_try_to_free_buffer().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
tytso committed Mar 9, 2014
1 parent d4e839d commit d2eb0b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/jbd2/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -1821,11 +1821,11 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)
if (buffer_locked(bh) || buffer_dirty(bh))
goto out;

if (jh->b_next_transaction != NULL)
if (jh->b_next_transaction != NULL || jh->b_transaction != NULL)
goto out;

spin_lock(&journal->j_list_lock);
if (jh->b_cp_transaction != NULL && jh->b_transaction == NULL) {
if (jh->b_cp_transaction != NULL) {
/* written-back checkpointed metadata buffer */
JBUFFER_TRACE(jh, "remove from checkpoint list");
__jbd2_journal_remove_checkpoint(jh);
Expand Down

0 comments on commit d2eb0b9

Please sign in to comment.