Message ID | 1545016436-4137-2-git-send-email-anand.jain@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] btrfs-progs: check for no result before using results | expand |
On 17.12.18 г. 5:13 ч., Anand Jain wrote: > 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> > > Fix it by checking if the return is > 0, as the kernel returns > BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS for the above cli, if the balance is > running. > > Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> > --- > cmds-replace.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/cmds-replace.c b/cmds-replace.c > index 42de4de8c031..696f24c5c6d5 100644 > --- a/cmds-replace.c > +++ b/cmds-replace.c > @@ -295,6 +295,10 @@ static int cmd_replace_start(int argc, char **argv) > 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 && > start_args.result != >
diff --git a/cmds-replace.c b/cmds-replace.c index 42de4de8c031..696f24c5c6d5 100644 --- a/cmds-replace.c +++ b/cmds-replace.c @@ -295,6 +295,10 @@ static int cmd_replace_start(int argc, char **argv) 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 && start_args.result !=
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> Fix it by checking if the return is > 0, as the kernel returns BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS for the above cli, if the balance is running. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- cmds-replace.c | 4 ++++ 1 file changed, 4 insertions(+)