Commit 5c50c9b8 authored by David Sterba's avatar David Sterba Committed by Josef Bacik

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: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 94ef7280
...@@ -723,7 +723,9 @@ static noinline int btrfs_mksubvol(struct path *parent, ...@@ -723,7 +723,9 @@ static noinline int btrfs_mksubvol(struct path *parent,
struct dentry *dentry; struct dentry *dentry;
int error; 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); dentry = lookup_one_len(name, parent->dentry, namelen);
error = PTR_ERR(dentry); error = PTR_ERR(dentry);
...@@ -2086,7 +2088,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2086,7 +2088,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
if (err) if (err)
goto out; 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); dentry = lookup_one_len(vol_args->name, parent, namelen);
if (IS_ERR(dentry)) { if (IS_ERR(dentry)) {
err = PTR_ERR(dentry); err = PTR_ERR(dentry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment