Skip to content

Commit

Permalink
Btrfs: fix resize a readonly device
Browse files Browse the repository at this point in the history
We should not resize a readonly device, fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
  • Loading branch information
Miao Xie authored and Josef Bacik committed Jan 14, 2013
1 parent 5c39da5 commit dba60f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1362,16 +1362,18 @@ static noinline int btrfs_ioctl_resize(struct file *file,
printk(KERN_INFO "btrfs: resizing devid %llu\n",
(unsigned long long)devid);
}

device = btrfs_find_device(root->fs_info, devid, NULL, NULL);
if (!device) {
printk(KERN_INFO "btrfs: resizer unable to find device %llu\n",
(unsigned long long)devid);
ret = -EINVAL;
goto out_free;
}
if (device->fs_devices && device->fs_devices->seeding) {

if (!device->writeable) {
printk(KERN_INFO "btrfs: resizer unable to apply on "
"seeding device %llu\n",
"readonly device %llu\n",
(unsigned long long)devid);
ret = -EINVAL;
goto out_free;
Expand Down

0 comments on commit dba60f3

Please sign in to comment.