]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.29.5/jbd2-update-locking-coments.patch
Drop watchdog patch
[thirdparty/kernel/stable-queue.git] / releases / 2.6.29.5 / jbd2-update-locking-coments.patch
1 From stable-bounces@linux.kernel.org Tue Jun 9 02:28:16 2009
2 From: Jan Kara <jack@suse.cz>
3 Date: Tue, 2 Jun 2009 08:07:52 -0400
4 Subject: jbd2: Update locking coments
5 To: stable@kernel.org
6 Cc: "Theodore Ts'o" <tytso@mit.edu>, linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>
7 Message-ID: <1243944479-20574-11-git-send-email-tytso@mit.edu>
8
9
10 From: Jan Kara <jack@suse.cz>
11
12 (cherry picked from commit 86db97c87f744364d5889ca8a4134ca2048b8f83)
13
14 Update information about locking in JBD2 revoke code. Inconsistency in
15 comments found by Lin Tan <tammy000@gmail.com>
16
17 CC: Lin Tan <tammy000@gmail.com>
18 Signed-off-by: Jan Kara <jack@suse.cz>
19 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
21 ---
22 fs/jbd2/revoke.c | 24 +++++++++++++++++++-----
23 1 file changed, 19 insertions(+), 5 deletions(-)
24
25 --- a/fs/jbd2/revoke.c
26 +++ b/fs/jbd2/revoke.c
27 @@ -55,6 +55,25 @@
28 * need do nothing.
29 * RevokeValid set, Revoked set:
30 * buffer has been revoked.
31 + *
32 + * Locking rules:
33 + * We keep two hash tables of revoke records. One hashtable belongs to the
34 + * running transaction (is pointed to by journal->j_revoke), the other one
35 + * belongs to the committing transaction. Accesses to the second hash table
36 + * happen only from the kjournald and no other thread touches this table. Also
37 + * journal_switch_revoke_table() which switches which hashtable belongs to the
38 + * running and which to the committing transaction is called only from
39 + * kjournald. Therefore we need no locks when accessing the hashtable belonging
40 + * to the committing transaction.
41 + *
42 + * All users operating on the hash table belonging to the running transaction
43 + * have a handle to the transaction. Therefore they are safe from kjournald
44 + * switching hash tables under them. For operations on the lists of entries in
45 + * the hash table j_revoke_lock is used.
46 + *
47 + * Finally, also replay code uses the hash tables but at this moment noone else
48 + * can touch them (filesystem isn't mounted yet) and hence no locking is
49 + * needed.
50 */
51
52 #ifndef __KERNEL__
53 @@ -401,8 +420,6 @@ int jbd2_journal_revoke(handle_t *handle
54 * the second time we would still have a pending revoke to cancel. So,
55 * do not trust the Revoked bit on buffers unless RevokeValid is also
56 * set.
57 - *
58 - * The caller must have the journal locked.
59 */
60 int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
61 {
62 @@ -480,10 +497,7 @@ void jbd2_journal_switch_revoke_table(jo
63 /*
64 * Write revoke records to the journal for all entries in the current
65 * revoke hash, deleting the entries as we go.
66 - *
67 - * Called with the journal lock held.
68 */
69 -
70 void jbd2_journal_write_revoke_records(journal_t *journal,
71 transaction_t *transaction)
72 {