Btrfs: fix trivial error in btrfs_ioctl_resize()
PATCH 3/3 Btrfs: fix trivial error in btrfs_ioctl_resize()
This patch fixes the following problem:
- improper return value
- unnecessary read-only check
Signed-off-by Miao Xie <[email protected]>
--- fs/btrfs/ioctl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
fs/btrfs/ioctl.c +7 -6
@@ -1326,9 +1326,6 @@ static noinline int btrfs_ioctl_resize(struct file *file,int ret =0 ;int mod =0 ; -if (root->fs_info->sb->s_flags &MS_RDONLY ) -return -EROFS ; -if (!capable (CAP_SYS_ADMIN ))return -EPERM ;
@@ -1361,6 +1358,10 @@ static noinline int btrfs_ioctl_resize(struct file *file, *devstr ='\0' ; devstr = vol_args->name; devid =simple_strtoull (devstr, &end,10 ); +if (!devid) { + ret = -EINVAL ; + goto out_free; + }printk (KERN_INFO "btrfs: resizing devid %llu\n" , (unsigned long long )devid); }
@@ -1369,7 +1370,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,if (!device) {printk (KERN_INFO "btrfs: resizer unable to find device %llu\n" , (unsigned long long )devid); - ret = -EINVAL ; + ret = -ENODEV ; goto out_free; }
@@ -1377,7 +1378,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,printk (KERN_INFO "btrfs: resizer unable to apply on " "readonly device %llu\n" , (unsigned long long )devid); - ret = -EINVAL ; + ret = -EPERM ; goto out_free; }
@@ -1399,7 +1400,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, }if (device->is_tgtdev_for_dev_replace) { - ret = -EINVAL ; + ret = -EPERM ; goto out_free; }
Signature · 1 line
1.7.11.7