Commit 93bc66f4 authored by Anand Jain's avatar Anand Jain Committed by David Sterba

btrfs: rename err to ret in btrfs_ioctl_snap_destroy()

Unify naming of return value to the preferred way.
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 5e45b044
...@@ -2386,7 +2386,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2386,7 +2386,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
struct mnt_idmap *idmap = file_mnt_idmap(file); struct mnt_idmap *idmap = file_mnt_idmap(file);
char *subvol_name, *subvol_name_ptr = NULL; char *subvol_name, *subvol_name_ptr = NULL;
int subvol_namelen; int subvol_namelen;
int err = 0; int ret = 0;
bool destroy_parent = false; bool destroy_parent = false;
/* We don't support snapshots with extent tree v2 yet. */ /* We don't support snapshots with extent tree v2 yet. */
...@@ -2402,7 +2402,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2402,7 +2402,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
return PTR_ERR(vol_args2); return PTR_ERR(vol_args2);
if (vol_args2->flags & ~BTRFS_SUBVOL_DELETE_ARGS_MASK) { if (vol_args2->flags & ~BTRFS_SUBVOL_DELETE_ARGS_MASK) {
err = -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto out; goto out;
} }
...@@ -2411,31 +2411,31 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2411,31 +2411,31 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
* name, same as v1 currently does. * name, same as v1 currently does.
*/ */
if (!(vol_args2->flags & BTRFS_SUBVOL_SPEC_BY_ID)) { if (!(vol_args2->flags & BTRFS_SUBVOL_SPEC_BY_ID)) {
err = btrfs_check_ioctl_vol_args2_subvol_name(vol_args2); ret = btrfs_check_ioctl_vol_args2_subvol_name(vol_args2);
if (err < 0) if (ret < 0)
goto out; goto out;
subvol_name = vol_args2->name; subvol_name = vol_args2->name;
err = mnt_want_write_file(file); ret = mnt_want_write_file(file);
if (err) if (ret)
goto out; goto out;
} else { } else {
struct inode *old_dir; struct inode *old_dir;
if (vol_args2->subvolid < BTRFS_FIRST_FREE_OBJECTID) { if (vol_args2->subvolid < BTRFS_FIRST_FREE_OBJECTID) {
err = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
err = mnt_want_write_file(file); ret = mnt_want_write_file(file);
if (err) if (ret)
goto out; goto out;
dentry = btrfs_get_dentry(fs_info->sb, dentry = btrfs_get_dentry(fs_info->sb,
BTRFS_FIRST_FREE_OBJECTID, BTRFS_FIRST_FREE_OBJECTID,
vol_args2->subvolid, 0); vol_args2->subvolid, 0);
if (IS_ERR(dentry)) { if (IS_ERR(dentry)) {
err = PTR_ERR(dentry); ret = PTR_ERR(dentry);
goto out_drop_write; goto out_drop_write;
} }
...@@ -2455,7 +2455,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2455,7 +2455,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
*/ */
dput(dentry); dput(dentry);
if (IS_ERR(parent)) { if (IS_ERR(parent)) {
err = PTR_ERR(parent); ret = PTR_ERR(parent);
goto out_drop_write; goto out_drop_write;
} }
old_dir = dir; old_dir = dir;
...@@ -2479,14 +2479,14 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2479,14 +2479,14 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
* to delete without an idmapped mount. * to delete without an idmapped mount.
*/ */
if (old_dir != dir && idmap != &nop_mnt_idmap) { if (old_dir != dir && idmap != &nop_mnt_idmap) {
err = -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto free_parent; goto free_parent;
} }
subvol_name_ptr = btrfs_get_subvol_name_from_objectid( subvol_name_ptr = btrfs_get_subvol_name_from_objectid(
fs_info, vol_args2->subvolid); fs_info, vol_args2->subvolid);
if (IS_ERR(subvol_name_ptr)) { if (IS_ERR(subvol_name_ptr)) {
err = PTR_ERR(subvol_name_ptr); ret = PTR_ERR(subvol_name_ptr);
goto free_parent; goto free_parent;
} }
/* subvol_name_ptr is already nul terminated */ /* subvol_name_ptr is already nul terminated */
...@@ -2497,14 +2497,14 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2497,14 +2497,14 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
if (IS_ERR(vol_args)) if (IS_ERR(vol_args))
return PTR_ERR(vol_args); return PTR_ERR(vol_args);
err = btrfs_check_ioctl_vol_args_path(vol_args); ret = btrfs_check_ioctl_vol_args_path(vol_args);
if (err < 0) if (ret < 0)
goto out; goto out;
subvol_name = vol_args->name; subvol_name = vol_args->name;
err = mnt_want_write_file(file); ret = mnt_want_write_file(file);
if (err) if (ret)
goto out; goto out;
} }
...@@ -2512,26 +2512,26 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2512,26 +2512,26 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
if (strchr(subvol_name, '/') || if (strchr(subvol_name, '/') ||
strncmp(subvol_name, "..", subvol_namelen) == 0) { strncmp(subvol_name, "..", subvol_namelen) == 0) {
err = -EINVAL; ret = -EINVAL;
goto free_subvol_name; goto free_subvol_name;
} }
if (!S_ISDIR(dir->i_mode)) { if (!S_ISDIR(dir->i_mode)) {
err = -ENOTDIR; ret = -ENOTDIR;
goto free_subvol_name; goto free_subvol_name;
} }
err = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT); ret = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
if (err == -EINTR) if (ret == -EINTR)
goto free_subvol_name; goto free_subvol_name;
dentry = lookup_one(idmap, subvol_name, parent, subvol_namelen); dentry = lookup_one(idmap, subvol_name, parent, subvol_namelen);
if (IS_ERR(dentry)) { if (IS_ERR(dentry)) {
err = PTR_ERR(dentry); ret = PTR_ERR(dentry);
goto out_unlock_dir; goto out_unlock_dir;
} }
if (d_really_is_negative(dentry)) { if (d_really_is_negative(dentry)) {
err = -ENOENT; ret = -ENOENT;
goto out_dput; goto out_dput;
} }
...@@ -2551,7 +2551,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2551,7 +2551,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
* Users who want to delete empty subvols should try * Users who want to delete empty subvols should try
* rmdir(2). * rmdir(2).
*/ */
err = -EPERM; ret = -EPERM;
if (!btrfs_test_opt(fs_info, USER_SUBVOL_RM_ALLOWED)) if (!btrfs_test_opt(fs_info, USER_SUBVOL_RM_ALLOWED))
goto out_dput; goto out_dput;
...@@ -2562,29 +2562,29 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2562,29 +2562,29 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
* of the subvol, not a random directory contained * of the subvol, not a random directory contained
* within it. * within it.
*/ */
err = -EINVAL; ret = -EINVAL;
if (root == dest) if (root == dest)
goto out_dput; goto out_dput;
err = inode_permission(idmap, inode, MAY_WRITE | MAY_EXEC); ret = inode_permission(idmap, inode, MAY_WRITE | MAY_EXEC);
if (err) if (ret)
goto out_dput; goto out_dput;
} }
/* check if subvolume may be deleted by a user */ /* check if subvolume may be deleted by a user */
err = btrfs_may_delete(idmap, dir, dentry, 1); ret = btrfs_may_delete(idmap, dir, dentry, 1);
if (err) if (ret)
goto out_dput; goto out_dput;
if (btrfs_ino(BTRFS_I(inode)) != BTRFS_FIRST_FREE_OBJECTID) { if (btrfs_ino(BTRFS_I(inode)) != BTRFS_FIRST_FREE_OBJECTID) {
err = -EINVAL; ret = -EINVAL;
goto out_dput; goto out_dput;
} }
btrfs_inode_lock(BTRFS_I(inode), 0); btrfs_inode_lock(BTRFS_I(inode), 0);
err = btrfs_delete_subvolume(BTRFS_I(dir), dentry); ret = btrfs_delete_subvolume(BTRFS_I(dir), dentry);
btrfs_inode_unlock(BTRFS_I(inode), 0); btrfs_inode_unlock(BTRFS_I(inode), 0);
if (!err) if (!ret)
d_delete_notify(dir, dentry); d_delete_notify(dir, dentry);
out_dput: out_dput:
...@@ -2601,7 +2601,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2601,7 +2601,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
out: out:
kfree(vol_args2); kfree(vol_args2);
kfree(vol_args); kfree(vol_args);
return err; return ret;
} }
static int btrfs_ioctl_defrag(struct file *file, void __user *argp) static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
......
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