]> Pileus Git - ~andy/linux/commitdiff
btrfs: make subvol creation/deletion killable in the early stages
authorDavid Sterba <dsterba@suse.cz>
Fri, 22 Mar 2013 18:12:51 +0000 (18:12 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Mon, 6 May 2013 19:54:26 +0000 (15:54 -0400)
The subvolume ioctls block on the parent directory mutex that can be
held by other concurrent snapshot activity for a long time. Give the
user at least some chance to get out of this situation by allowing
to send a kill signal.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/ioctl.c

index 2c02310ff2d96320ebf2d348ed339dd0ea047e0f..9c44d657b795076a24855ae34ba9f48086f1835b 100644 (file)
@@ -723,7 +723,9 @@ static noinline int btrfs_mksubvol(struct path *parent,
        struct dentry *dentry;
        int error;
 
-       mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
+       error = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
+       if (error == -EINTR)
+               return error;
 
        dentry = lookup_one_len(name, parent->dentry, namelen);
        error = PTR_ERR(dentry);
@@ -2086,7 +2088,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
        if (err)
                goto out;
 
-       mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
+       err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
+       if (err == -EINTR)
+               goto out;
        dentry = lookup_one_len(vol_args->name, parent, namelen);
        if (IS_ERR(dentry)) {
                err = PTR_ERR(dentry);