Commit e57138b3 authored by Anand Jain's avatar Anand Jain Committed by Chris Mason

btrfs: return btrfs error code for dev excl ops err

now threads can return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
as defined in btrfs.h for the dev excl operation error in
the FS, which means with this kernel would stop logging
(almost an user error) into the /var/log/messages

v2: accepts Josef' comment
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 77cef2ec
...@@ -1394,9 +1394,8 @@ static noinline int btrfs_ioctl_resize(struct file *file, ...@@ -1394,9 +1394,8 @@ static noinline int btrfs_ioctl_resize(struct file *file,
if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
1)) { 1)) {
pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
mnt_drop_write_file(file); mnt_drop_write_file(file);
return -EINVAL; return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
} }
mutex_lock(&root->fs_info->volume_mutex); mutex_lock(&root->fs_info->volume_mutex);
...@@ -2379,8 +2378,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) ...@@ -2379,8 +2378,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg)
if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
1)) { 1)) {
pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
return -EINVAL;
} }
mutex_lock(&root->fs_info->volume_mutex); mutex_lock(&root->fs_info->volume_mutex);
...@@ -3673,8 +3671,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg) ...@@ -3673,8 +3671,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg)
if (atomic_xchg( if (atomic_xchg(
&root->fs_info->mutually_exclusive_operation_running, &root->fs_info->mutually_exclusive_operation_running,
1)) { 1)) {
pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
ret = -EINPROGRESS;
} else { } else {
ret = btrfs_dev_replace_start(root, p); ret = btrfs_dev_replace_start(root, p);
atomic_set( atomic_set(
...@@ -3918,8 +3915,7 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg) ...@@ -3918,8 +3915,7 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
} else { } else {
/* this is (1) */ /* this is (1) */
mutex_unlock(&fs_info->balance_mutex); mutex_unlock(&fs_info->balance_mutex);
pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
ret = -EINVAL;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment