reiserfs: Relax reiserfs_xattr_set_handle() while acquiring xattr locks
authorFrederic Weisbecker <fweisbec@gmail.com>
Thu, 7 Jan 2010 14:55:31 +0000 (15:55 +0100)
committerFrederic Weisbecker <fweisbec@gmail.com>
Thu, 7 Jan 2010 15:02:53 +0000 (16:02 +0100)
Fix remaining xattr locks acquired in reiserfs_xattr_set_handle()
while we are holding the reiserfs lock to avoid lock inversions.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Christian Kujau <lists@nerdbynature.de>
Cc: Alexander Beregalov <a.beregalov@gmail.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
fs/reiserfs/xattr.c

index 4899d789ba67e6f830f451d3e2dc925437742df9..7fee995c25ab2f6cc0e0e70be44549aeb2087fd1 100644 (file)
@@ -559,8 +559,12 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
                        .ia_size = buffer_size,
                        .ia_valid = ATTR_SIZE | ATTR_CTIME,
                };
+
+               reiserfs_write_unlock(inode->i_sb);
                mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR);
                down_write(&dentry->d_inode->i_alloc_sem);
+               reiserfs_write_lock(inode->i_sb);
+
                err = reiserfs_setattr(dentry, &newattrs);
                up_write(&dentry->d_inode->i_alloc_sem);
                mutex_unlock(&dentry->d_inode->i_mutex);