btrfs-progs: dev replace: gracefully handle the exclusive operation report
Replace start fails to report the appropriate error if balance is already running, as below: $ btrfs rep start -B -f /dev/sdb /dev/sde /btrfs ERROR: ioctl(DEV_REPLACE_START) on '/btrfs' returns error: <illegal result value> Translate the positive values, the exclusive operation is reported as BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS when balance is running. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f79fb2cf3e
commit
ae45af7a92
|
@ -295,6 +295,10 @@ static int cmd_replace_start(int argc, char **argv)
|
||||||
goto leave_with_error;
|
goto leave_with_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret > 0)
|
||||||
|
error("ioctl(DEV_REPLACE_START) '%s': %s", path,
|
||||||
|
btrfs_err_str(ret));
|
||||||
|
|
||||||
if (start_args.result != BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT &&
|
if (start_args.result != BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT &&
|
||||||
start_args.result != BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR) {
|
start_args.result != BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR) {
|
||||||
error("ioctl(DEV_REPLACE_START) on '%s' returns error: %s",
|
error("ioctl(DEV_REPLACE_START) on '%s' returns error: %s",
|
||||||
|
|
Loading…
Reference in New Issue