Skip to content

Commit

Permalink
reiserfs: don't acquire lock recursively in reiserfs_acl_chmod
Browse files Browse the repository at this point in the history
reiserfs_acl_chmod() can be called by reiserfs_set_attr() and then take
the reiserfs lock a second time.  Thereafter it may call journal_begin()
that definitely requires the lock not to be nested in order to release
it before taking the journal mutex because the reiserfs lock depends on
the journal mutex already.

So, aviod nesting the lock in reiserfs_acl_chmod().

Reported-by: Pawel Zawora <pzawora@gmail.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Tested-by: Pawel Zawora <pzawora@gmail.com>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: <stable@kernel.org>		[2.6.32.x+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Frederic Weisbecker authored and Linus Torvalds committed Dec 2, 2010
1 parent 0bae35e commit 238af87
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/reiserfs/xattr_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ int reiserfs_acl_chmod(struct inode *inode)
struct reiserfs_transaction_handle th;
size_t size = reiserfs_xattr_nblocks(inode,
reiserfs_acl_size(clone->a_count));
reiserfs_write_lock(inode->i_sb);
int depth;

depth = reiserfs_write_lock_once(inode->i_sb);
error = journal_begin(&th, inode->i_sb, size * 2);
if (!error) {
int error2;
Expand All @@ -482,7 +484,7 @@ int reiserfs_acl_chmod(struct inode *inode)
if (error2)
error = error2;
}
reiserfs_write_unlock(inode->i_sb);
reiserfs_write_unlock_once(inode->i_sb, depth);
}
posix_acl_release(clone);
return error;
Expand Down

0 comments on commit 238af87

Please sign in to comment.