|
@@ -2689,32 +2689,31 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
- vol_args = memdup_user(arg, sizeof(*vol_args));
|
|
|
|
- if (IS_ERR(vol_args)) {
|
|
|
|
- ret = PTR_ERR(vol_args);
|
|
|
|
- goto err_drop;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
|
|
|
|
-
|
|
|
|
if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
|
|
if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
|
|
1)) {
|
|
1)) {
|
|
ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
|
|
ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
|
|
|
|
+ goto out_drop_write;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ vol_args = memdup_user(arg, sizeof(*vol_args));
|
|
|
|
+ if (IS_ERR(vol_args)) {
|
|
|
|
+ ret = PTR_ERR(vol_args);
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
|
|
mutex_lock(&root->fs_info->volume_mutex);
|
|
mutex_lock(&root->fs_info->volume_mutex);
|
|
ret = btrfs_rm_device(root, vol_args->name);
|
|
ret = btrfs_rm_device(root, vol_args->name);
|
|
mutex_unlock(&root->fs_info->volume_mutex);
|
|
mutex_unlock(&root->fs_info->volume_mutex);
|
|
- atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
|
|
|
|
|
|
|
|
if (!ret)
|
|
if (!ret)
|
|
btrfs_info(root->fs_info, "disk deleted %s",vol_args->name);
|
|
btrfs_info(root->fs_info, "disk deleted %s",vol_args->name);
|
|
-
|
|
|
|
-out:
|
|
|
|
kfree(vol_args);
|
|
kfree(vol_args);
|
|
-err_drop:
|
|
|
|
|
|
+out:
|
|
|
|
+ atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
|
|
|
|
+out_drop_write:
|
|
mnt_drop_write_file(file);
|
|
mnt_drop_write_file(file);
|
|
|
|
+
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|