diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
| -rw-r--r-- | fs/btrfs/ioctl.c | 20 | 
1 files changed, 12 insertions, 8 deletions
| diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index fb8cc9642ac4..edfecfe62b4b 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -617,11 +617,13 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,  		 * Since we don't abort the transaction in this case, free the  		 * tree block so that we don't leak space and leave the  		 * filesystem in an inconsistent state (an extent item in the -		 * extent tree without backreferences). Also no need to have -		 * the tree block locked since it is not in any tree at this -		 * point, so no other task can find it and use it. +		 * extent tree with a backreference for a root that does not +		 * exists).  		 */ -		btrfs_free_tree_block(trans, root, leaf, 0, 1); +		btrfs_tree_lock(leaf); +		btrfs_clean_tree_block(leaf); +		btrfs_tree_unlock(leaf); +		btrfs_free_tree_block(trans, objectid, leaf, 0, 1);  		free_extent_buffer(leaf);  		goto fail;  	} @@ -3187,10 +3189,8 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)  		return -EPERM;  	vol_args = memdup_user(arg, sizeof(*vol_args)); -	if (IS_ERR(vol_args)) { -		ret = PTR_ERR(vol_args); -		goto out; -	} +	if (IS_ERR(vol_args)) +		return PTR_ERR(vol_args);  	if (vol_args->flags & ~BTRFS_DEVICE_REMOVE_ARGS_MASK) {  		ret = -EOPNOTSUPP; @@ -3985,6 +3985,10 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)  	bool need_unlock; /* for mut. excl. ops lock */  	int ret; +	if (!arg) +		btrfs_warn(fs_info, +	"IOC_BALANCE ioctl (v1) is deprecated and will be removed in kernel 5.18"); +  	if (!capable(CAP_SYS_ADMIN))  		return -EPERM; |