]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.36.2/reiserfs-don-t-acquire-lock-recursively-in-reiserfs_acl_chmod.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.2 / reiserfs-don-t-acquire-lock-recursively-in-reiserfs_acl_chmod.patch
CommitLineData
ae06513c
GKH
1From 238af8751f64a75f8b638193353b1c31ea32e738 Mon Sep 17 00:00:00 2001
2From: Frederic Weisbecker <fweisbec@gmail.com>
3Date: Thu, 2 Dec 2010 14:31:16 -0800
4Subject: reiserfs: don't acquire lock recursively in reiserfs_acl_chmod
5
6From: Frederic Weisbecker <fweisbec@gmail.com>
7
8commit 238af8751f64a75f8b638193353b1c31ea32e738 upstream.
9
10reiserfs_acl_chmod() can be called by reiserfs_set_attr() and then take
11the reiserfs lock a second time. Thereafter it may call journal_begin()
12that definitely requires the lock not to be nested in order to release
13it before taking the journal mutex because the reiserfs lock depends on
14the journal mutex already.
15
16So, aviod nesting the lock in reiserfs_acl_chmod().
17
18Reported-by: Pawel Zawora <pzawora@gmail.com>
19Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
20Tested-by: Pawel Zawora <pzawora@gmail.com>
21Cc: Jeff Mahoney <jeffm@suse.com>
22Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
23Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24Signed-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;