reiserfs: Safely acquire i_mutex from xattr_rmdir
authorFrederic Weisbecker <fweisbec@gmail.com>
Wed, 30 Dec 2009 06:40:39 +0000 (07:40 +0100)
committerFrederic Weisbecker <fweisbec@gmail.com>
Sat, 2 Jan 2010 00:59:48 +0000 (01:59 +0100)
Relax the reiserfs lock before taking the inode mutex from
xattr_rmdir() to avoid the usual reiserfs lock <-> inode mutex
bad dependency.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Tested-by: 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 bfdac66fd8e253bbda0e8d55281fca1de747a8fa..9623cfe2371cf6fe51239ff6b73065f0ba15c35a 100644 (file)
@@ -98,7 +98,8 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry)
        BUG_ON(!mutex_is_locked(&dir->i_mutex));
        vfs_dq_init(dir);
 
-       mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
+       reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex,
+                                       I_MUTEX_CHILD, dir->i_sb);
        dentry_unhash(dentry);
        error = dir->i_op->rmdir(dir, dentry);
        if (!error)