Btrfs: fix lockdep warning on clone ioctl
authorSage Weil <sage@newdream.net>
Fri, 29 Oct 2010 19:37:33 +0000 (15:37 -0400)
committerChris Mason <chris.mason@oracle.com>
Fri, 29 Oct 2010 19:37:33 +0000 (15:37 -0400)
I'm no lockdep expert, but this appears to make the lockdep warning go
away for the i_mutex locking in the clone ioctl.

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ioctl.c

index 3fe15e435b5cbc5a541718be67f05bebd55ed759..93d69b32028e3f791aa386a5ca3444504d830a24 100644 (file)
@@ -1492,11 +1492,11 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
        path->reada = 2;
 
        if (inode < src) {
-               mutex_lock(&inode->i_mutex);
-               mutex_lock(&src->i_mutex);
+               mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT);
+               mutex_lock_nested(&src->i_mutex, I_MUTEX_CHILD);
        } else {
-               mutex_lock(&src->i_mutex);
-               mutex_lock(&inode->i_mutex);
+               mutex_lock_nested(&src->i_mutex, I_MUTEX_PARENT);
+               mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD);
        }
 
        /* determine range to clone */