Btrfs: fix resize a readonly device
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>
This commit is contained in:
@@ -1362,6 +1362,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
|
|||||||
printk(KERN_INFO "btrfs: resizing devid %llu\n",
|
printk(KERN_INFO "btrfs: resizing devid %llu\n",
|
||||||
(unsigned long long)devid);
|
(unsigned long long)devid);
|
||||||
}
|
}
|
||||||
|
|
||||||
device = btrfs_find_device(root->fs_info, devid, NULL, NULL);
|
device = btrfs_find_device(root->fs_info, devid, NULL, NULL);
|
||||||
if (!device) {
|
if (!device) {
|
||||||
printk(KERN_INFO "btrfs: resizer unable to find device %llu\n",
|
printk(KERN_INFO "btrfs: resizer unable to find device %llu\n",
|
||||||
@@ -1369,9 +1370,10 @@ static noinline int btrfs_ioctl_resize(struct file *file,
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (device->fs_devices && device->fs_devices->seeding) {
|
|
||||||
|
if (!device->writeable) {
|
||||||
printk(KERN_INFO "btrfs: resizer unable to apply on "
|
printk(KERN_INFO "btrfs: resizer unable to apply on "
|
||||||
"seeding device %llu\n",
|
"readonly device %llu\n",
|
||||||
(unsigned long long)devid);
|
(unsigned long long)devid);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
Reference in New Issue
Block a user