btrfs: disable device manipulation ioctl's EXTENT_TREE_V2
Device add, remove, and replace all require balance, which doesn't work right now on extent tree v2, so disable these for now. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
4b34925399
commit
914a519b19
@ -3449,6 +3449,11 @@ static long btrfs_ioctl_add_dev(struct btrfs_fs_info *fs_info, void __user *arg)
|
|||||||
if (!capable(CAP_SYS_ADMIN))
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
|
if (btrfs_fs_incompat(fs_info, EXTENT_TREE_V2)) {
|
||||||
|
btrfs_err(fs_info, "device add not supported on extent tree v2 yet");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!btrfs_exclop_start(fs_info, BTRFS_EXCLOP_DEV_ADD)) {
|
if (!btrfs_exclop_start(fs_info, BTRFS_EXCLOP_DEV_ADD)) {
|
||||||
if (!btrfs_exclop_start_try_lock(fs_info, BTRFS_EXCLOP_DEV_ADD))
|
if (!btrfs_exclop_start_try_lock(fs_info, BTRFS_EXCLOP_DEV_ADD))
|
||||||
return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
|
return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
|
||||||
@ -4073,6 +4078,11 @@ static long btrfs_ioctl_dev_replace(struct btrfs_fs_info *fs_info,
|
|||||||
if (!capable(CAP_SYS_ADMIN))
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
|
if (btrfs_fs_incompat(fs_info, EXTENT_TREE_V2)) {
|
||||||
|
btrfs_err(fs_info, "device replace not supported on extent tree v2 yet");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
p = memdup_user(arg, sizeof(*p));
|
p = memdup_user(arg, sizeof(*p));
|
||||||
if (IS_ERR(p))
|
if (IS_ERR(p))
|
||||||
return PTR_ERR(p);
|
return PTR_ERR(p);
|
||||||
|
@ -2085,6 +2085,11 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info,
|
|||||||
u64 num_devices;
|
u64 num_devices;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (btrfs_fs_incompat(fs_info, EXTENT_TREE_V2)) {
|
||||||
|
btrfs_err(fs_info, "device remove not supported on extent tree v2 yet");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The device list in fs_devices is accessed without locks (neither
|
* The device list in fs_devices is accessed without locks (neither
|
||||||
* uuid_mutex nor device_list_mutex) as it won't change on a mounted
|
* uuid_mutex nor device_list_mutex) as it won't change on a mounted
|
||||||
|
Loading…
x
Reference in New Issue
Block a user