aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2013-03-22 14:12:51 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:54:26 -0400
commit5c50c9b89f1179237e0c0afb399432924058e756 (patch)
tree29b515dab2036bb3d728dd9d3b9b92b767fbae2d /fs/btrfs/ioctl.c
parent94ef7280e8b3a5b13ba3cc515e5c198c1181176e (diff)
btrfs: make subvol creation/deletion killable in the early stages
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>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 2c02310ff2d9..9c44d657b795 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -723,7 +723,9 @@ static noinline int btrfs_mksubvol(struct path *parent,
723 struct dentry *dentry; 723 struct dentry *dentry;
724 int error; 724 int error;
725 725
726 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); 726 error = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
727 if (error == -EINTR)
728 return error;
727 729
728 dentry = lookup_one_len(name, parent->dentry, namelen); 730 dentry = lookup_one_len(name, parent->dentry, namelen);
729 error = PTR_ERR(dentry); 731 error = PTR_ERR(dentry);
@@ -2086,7 +2088,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2086 if (err) 2088 if (err)
2087 goto out; 2089 goto out;
2088 2090
2089 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); 2091 err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
2092 if (err == -EINTR)
2093 goto out;
2090 dentry = lookup_one_len(vol_args->name, parent, namelen); 2094 dentry = lookup_one_len(vol_args->name, parent, namelen);
2091 if (IS_ERR(dentry)) { 2095 if (IS_ERR(dentry)) {
2092 err = PTR_ERR(dentry); 2096 err = PTR_ERR(dentry);