]>
Commit | Line | Data |
---|---|---|
4f0a39a2 GKH |
1 | From 559cce698eaf4ccecb2213b2519ea3a0413e5155 Mon Sep 17 00:00:00 2001 |
2 | From: Taesoo Kim <tsgatesv@gmail.com> | |
3 | Date: Wed, 12 Oct 2016 23:19:18 -0400 | |
4 | Subject: jbd2: fix incorrect unlock on j_list_lock | |
5 | ||
6 | From: Taesoo Kim <tsgatesv@gmail.com> | |
7 | ||
8 | commit 559cce698eaf4ccecb2213b2519ea3a0413e5155 upstream. | |
9 | ||
10 | When 'jh->b_transaction == transaction' (asserted by below) | |
11 | ||
12 | J_ASSERT_JH(jh, (jh->b_transaction == transaction || ... | |
13 | ||
14 | 'journal->j_list_lock' will be incorrectly unlocked, since | |
15 | the the lock is aquired only at the end of if / else-if | |
16 | statements (missing the else case). | |
17 | ||
18 | Signed-off-by: Taesoo Kim <tsgatesv@gmail.com> | |
19 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | |
20 | Reviewed-by: Andreas Dilger <adilger@dilger.ca> | |
21 | Fixes: 6e4862a5bb9d12be87e4ea5d9a60836ebed71d28 | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | ||
24 | --- | |
25 | fs/jbd2/transaction.c | 3 ++- | |
26 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
27 | ||
28 | --- a/fs/jbd2/transaction.c | |
29 | +++ b/fs/jbd2/transaction.c | |
30 | @@ -1149,6 +1149,7 @@ int jbd2_journal_get_create_access(handl | |
31 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); | |
32 | spin_lock(&journal->j_list_lock); | |
33 | __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); | |
34 | + spin_unlock(&journal->j_list_lock); | |
35 | } else if (jh->b_transaction == journal->j_committing_transaction) { | |
36 | /* first access by this transaction */ | |
37 | jh->b_modified = 0; | |
38 | @@ -1156,8 +1157,8 @@ int jbd2_journal_get_create_access(handl | |
39 | JBUFFER_TRACE(jh, "set next transaction"); | |
40 | spin_lock(&journal->j_list_lock); | |
41 | jh->b_next_transaction = transaction; | |
42 | + spin_unlock(&journal->j_list_lock); | |
43 | } | |
44 | - spin_unlock(&journal->j_list_lock); | |
45 | jbd_unlock_bh_state(bh); | |
46 | ||
47 | /* |