Skip to content

Commit 559cce6

Browse files
tsgatestytso
authored andcommitted
jbd2: fix incorrect unlock on j_list_lock
When 'jh->b_transaction == transaction' (asserted by below) J_ASSERT_JH(jh, (jh->b_transaction == transaction || ... 'journal->j_list_lock' will be incorrectly unlocked, since the the lock is aquired only at the end of if / else-if statements (missing the else case). Signed-off-by: Taesoo Kim <tsgatesv@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Fixes: 6e4862a Cc: stable@vger.kernel.org # 3.14+
1 parent 651e1c3 commit 559cce6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/jbd2/transaction.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,15 +1149,16 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
11491149
JBUFFER_TRACE(jh, "file as BJ_Reserved");
11501150
spin_lock(&journal->j_list_lock);
11511151
__jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
1152+
spin_unlock(&journal->j_list_lock);
11521153
} else if (jh->b_transaction == journal->j_committing_transaction) {
11531154
/* first access by this transaction */
11541155
jh->b_modified = 0;
11551156

11561157
JBUFFER_TRACE(jh, "set next transaction");
11571158
spin_lock(&journal->j_list_lock);
11581159
jh->b_next_transaction = transaction;
1160+
spin_unlock(&journal->j_list_lock);
11591161
}
1160-
spin_unlock(&journal->j_list_lock);
11611162
jbd_unlock_bh_state(bh);
11621163

11631164
/*

0 commit comments

Comments
 (0)