]>
Commit | Line | Data |
---|---|---|
ae06513c GKH |
1 | From 238af8751f64a75f8b638193353b1c31ea32e738 Mon Sep 17 00:00:00 2001 |
2 | From: Frederic Weisbecker <fweisbec@gmail.com> | |
3 | Date: Thu, 2 Dec 2010 14:31:16 -0800 | |
4 | Subject: reiserfs: don't acquire lock recursively in reiserfs_acl_chmod | |
5 | ||
6 | From: Frederic Weisbecker <fweisbec@gmail.com> | |
7 | ||
8 | commit 238af8751f64a75f8b638193353b1c31ea32e738 upstream. | |
9 | ||
10 | reiserfs_acl_chmod() can be called by reiserfs_set_attr() and then take | |
11 | the reiserfs lock a second time. Thereafter it may call journal_begin() | |
12 | that definitely requires the lock not to be nested in order to release | |
13 | it before taking the journal mutex because the reiserfs lock depends on | |
14 | the journal mutex already. | |
15 | ||
16 | So, aviod nesting the lock in reiserfs_acl_chmod(). | |
17 | ||
18 | Reported-by: Pawel Zawora <pzawora@gmail.com> | |
19 | Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> | |
20 | Tested-by: Pawel Zawora <pzawora@gmail.com> | |
21 | Cc: Jeff Mahoney <jeffm@suse.com> | |
22 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | |
23 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | |
24 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
25 | ||
26 | --- | |
27 | fs/reiserfs/xattr_acl.c | 6 ++++-- | |
28 | 1 file changed, 4 insertions(+), 2 deletions(-) | |
29 | ||
30 | --- a/fs/reiserfs/xattr_acl.c | |
31 | +++ b/fs/reiserfs/xattr_acl.c | |
32 | @@ -472,7 +472,9 @@ int reiserfs_acl_chmod(struct inode *ino | |
33 | struct reiserfs_transaction_handle th; | |
34 | size_t size = reiserfs_xattr_nblocks(inode, | |
35 | reiserfs_acl_size(clone->a_count)); | |
36 | - reiserfs_write_lock(inode->i_sb); | |
37 | + int depth; | |
38 | + | |
39 | + depth = reiserfs_write_lock_once(inode->i_sb); | |
40 | error = journal_begin(&th, inode->i_sb, size * 2); | |
41 | if (!error) { | |
42 | int error2; | |
43 | @@ -482,7 +484,7 @@ int reiserfs_acl_chmod(struct inode *ino | |
44 | if (error2) | |
45 | error = error2; | |
46 | } | |
47 | - reiserfs_write_unlock(inode->i_sb); | |
48 | + reiserfs_write_unlock_once(inode->i_sb, depth); | |
49 | } | |
50 | posix_acl_release(clone); | |
51 | return error; |