1 jbd2: fix incorrect unlock on j_list_lock
3 When 'jh->b_transaction == transaction' (asserted by below)
5 J_ASSERT_JH(jh, (jh->b_transaction == transaction || ...
7 'journal->j_list_lock' will be incorrectly unlocked, since
8 the the lock is aquired only at the end of if / else-if
9 statements (missing the else case).
11 This bug has been introduced by an earlier change named
12 "jbd2: minimize region locked by j_list_lock in journal_get_create_access()".
14 Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
16 Index: linux-3.10.0-327.36.1.el7/fs/jbd2/transaction.c
17 ===================================================================
18 --- linux-3.10.0-327.36.1.el7.orig/fs/jbd2/transaction.c
19 +++ linux-3.10.0-327.36.1.el7/fs/jbd2/transaction.c
21 JBUFFER_TRACE(jh, "file as BJ_Reserved");
22 spin_lock(&journal->j_list_lock);
23 __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
24 + spin_unlock(&journal->j_list_lock);
25 } else if (jh->b_transaction == journal->j_committing_transaction) {
26 /* first access by this transaction */
29 JBUFFER_TRACE(jh, "set next transaction");
30 spin_lock(&journal->j_list_lock);
31 jh->b_next_transaction = transaction;
32 + spin_unlock(&journal->j_list_lock);
34 - spin_unlock(&journal->j_list_lock);
35 jbd_unlock_bh_state(bh);