aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-12-21 04:21:30 -0500
committerJosef Bacik <jbacik@fusionio.com>2013-02-20 09:36:44 -0500
commitdfd79829b709af3c2ac55951353a874ae89f41c3 (patch)
tree61d5735498497251b1c757679715c7cb01f86c34 /fs
parent4eee4fa4f8ab8c2b2623c22be4c3cb91d525aa57 (diff)
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 <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ioctl.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a31cd931d36e..744aabf11ce5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1329,9 +1329,6 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1329 int ret = 0; 1329 int ret = 0;
1330 int mod = 0; 1330 int mod = 0;
1331 1331
1332 if (root->fs_info->sb->s_flags & MS_RDONLY)
1333 return -EROFS;
1334
1335 if (!capable(CAP_SYS_ADMIN)) 1332 if (!capable(CAP_SYS_ADMIN))
1336 return -EPERM; 1333 return -EPERM;
1337 1334
@@ -1363,6 +1360,10 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1363 *devstr = '\0'; 1360 *devstr = '\0';
1364 devstr = vol_args->name; 1361 devstr = vol_args->name;
1365 devid = simple_strtoull(devstr, &end, 10); 1362 devid = simple_strtoull(devstr, &end, 10);
1363 if (!devid) {
1364 ret = -EINVAL;
1365 goto out_free;
1366 }
1366 printk(KERN_INFO "btrfs: resizing devid %llu\n", 1367 printk(KERN_INFO "btrfs: resizing devid %llu\n",
1367 (unsigned long long)devid); 1368 (unsigned long long)devid);
1368 } 1369 }
@@ -1371,7 +1372,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1371 if (!device) { 1372 if (!device) {
1372 printk(KERN_INFO "btrfs: resizer unable to find device %llu\n", 1373 printk(KERN_INFO "btrfs: resizer unable to find device %llu\n",
1373 (unsigned long long)devid); 1374 (unsigned long long)devid);
1374 ret = -EINVAL; 1375 ret = -ENODEV;
1375 goto out_free; 1376 goto out_free;
1376 } 1377 }
1377 1378
@@ -1379,7 +1380,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1379 printk(KERN_INFO "btrfs: resizer unable to apply on " 1380 printk(KERN_INFO "btrfs: resizer unable to apply on "
1380 "readonly device %llu\n", 1381 "readonly device %llu\n",
1381 (unsigned long long)devid); 1382 (unsigned long long)devid);
1382 ret = -EINVAL; 1383 ret = -EPERM;
1383 goto out_free; 1384 goto out_free;
1384 } 1385 }
1385 1386
@@ -1401,7 +1402,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1401 } 1402 }
1402 1403
1403 if (device->is_tgtdev_for_dev_replace) { 1404 if (device->is_tgtdev_for_dev_replace) {
1404 ret = -EINVAL; 1405 ret = -EPERM;
1405 goto out_free; 1406 goto out_free;
1406 } 1407 }
1407 1408