Re: [PATCH 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx>

Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx>

> ---
>  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 !=
> 



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux