Skip to contentSkip to conversation

reiserfs: Don't acquire lock recursively in reiserfs_acl_chmod

PATCH New Frederic Weisbecker 1 participant 1 message Nov 30, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiserfs: Don't acquire lock recursively in reiserfs_acl_chmod

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 definetly 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, prevent from nesting the lock in reiserfs_acl_chmod().

---
 fs/reiserfs/xattr_acl.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/reiserfs/xattr_acl.c +4 -2
index 536d697..90d2fcb 100644
@@ -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;
@@ -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;
Signature · 1 line
1.7.3.2