diff mbox series

[RESEND,1/2] btrfs-progs: check for no result before using results

Message ID 1548929141-10695-1-git-send-email-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series [RESEND,1/2] btrfs-progs: check for no result before using results | expand

Commit Message

Anand Jain Jan. 31, 2019, 10:05 a.m. UTC
User space understands the ioctl BTRFS_IOC_DEV_REPLACE command status
using the struct btrfs_ioctl_dev_replace_args::result, and so userspace
initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude
this value in checking for the error.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds-replace.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Anand Jain Feb. 7, 2019, 9:38 p.m. UTC | #1
Ping?

Thanks, Anand

On 1/31/19 6:05 PM, Anand Jain wrote:
> User space understands the ioctl BTRFS_IOC_DEV_REPLACE command status
> using the struct btrfs_ioctl_dev_replace_args::result, and so userspace
> initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude
> this value in checking for the error.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>   cmds-replace.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/cmds-replace.c b/cmds-replace.c
> index b30e6c781e64..42de4de8c031 100644
> --- a/cmds-replace.c
> +++ b/cmds-replace.c
> @@ -296,6 +296,8 @@ static int cmd_replace_start(int argc, char **argv)
>   		}
>   
>   		if (start_args.result !=
> +		    BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT &&
> +		    start_args.result !=
>   		    BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR) {
>   			error("ioctl(DEV_REPLACE_START) on '%s' returns error: %s",
>   				path,
>
David Sterba March 1, 2019, 4:41 p.m. UTC | #2
On Thu, Jan 31, 2019 at 06:05:40PM +0800, Anand Jain wrote:
> User space understands the ioctl BTRFS_IOC_DEV_REPLACE command status
> using the struct btrfs_ioctl_dev_replace_args::result, and so userspace
> initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude
> this value in checking for the error.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

1 and 2 applied, thanks.
Anand Jain March 2, 2019, 10:19 a.m. UTC | #3
On 3/2/19 12:41 AM, David Sterba wrote:
> On Thu, Jan 31, 2019 at 06:05:40PM +0800, Anand Jain wrote:
>> User space understands the ioctl BTRFS_IOC_DEV_REPLACE command status
>> using the struct btrfs_ioctl_dev_replace_args::result, and so userspace
>> initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude
>> this value in checking for the error.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> 
> 1 and 2 applied, thanks.
> 

Thanks.

  While at btrfs-progs you could include [1] as well.

[1]
  [PATCH v4] btrfs-progs: dump-tree: add noscan option
  https://patchwork.kernel.org/patch/10832585/

-Anand
diff mbox series

Patch

diff --git a/cmds-replace.c b/cmds-replace.c
index b30e6c781e64..42de4de8c031 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -296,6 +296,8 @@  static int cmd_replace_start(int argc, char **argv)
 		}
 
 		if (start_args.result !=
+		    BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT &&
+		    start_args.result !=
 		    BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR) {
 			error("ioctl(DEV_REPLACE_START) on '%s' returns error: %s",
 				path,