Whamcloud - gitweb
LU-13437 lmv: check stripe FID sanity
[fs/lustre-release.git] / lustre / kernel_patches / patches / jbd2-fix-j_list_lock-unlock-3.10-rhel7.patch
1 jbd2: fix incorrect unlock on j_list_lock
2
3 When 'jh->b_transaction == transaction' (asserted by below)
4
5   J_ASSERT_JH(jh, (jh->b_transaction == transaction || ...
6
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).
10
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()".
13
14 Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
15
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
20 @@ -1091,6 +1091,7 @@
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 */
27                 jh->b_modified = 0;
28 @@ -1098,8 +1099,8 @@
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);
33         }
34 -       spin_unlock(&journal->j_list_lock);
35         jbd_unlock_bh_state(bh);
36  
37         /*