linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] btrfs-progs: check for no result before using results
@ 2019-01-31 10:05 Anand Jain
  2019-01-31 10:05 ` [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report Anand Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Anand Jain @ 2019-01-31 10:05 UTC (permalink / raw)
  To: linux-btrfs

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,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report
  2019-01-31 10:05 [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
@ 2019-01-31 10:05 ` Anand Jain
  2019-02-07 21:38 ` [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
  2019-03-01 16:41 ` David Sterba
  2 siblings, 0 replies; 9+ messages in thread
From: Anand Jain @ 2019-01-31 10:05 UTC (permalink / raw)
  To: linux-btrfs

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH RESEND 1/2] btrfs-progs: check for no result before using results
  2019-01-31 10:05 [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
  2019-01-31 10:05 ` [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report Anand Jain
@ 2019-02-07 21:38 ` Anand Jain
  2019-03-01 16:41 ` David Sterba
  2 siblings, 0 replies; 9+ messages in thread
From: Anand Jain @ 2019-02-07 21:38 UTC (permalink / raw)
  To: linux-btrfs, dsterba


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,
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RESEND 1/2] btrfs-progs: check for no result before using results
  2019-01-31 10:05 [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
  2019-01-31 10:05 ` [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report Anand Jain
  2019-02-07 21:38 ` [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
@ 2019-03-01 16:41 ` David Sterba
  2019-03-02 10:19   ` Anand Jain
  2 siblings, 1 reply; 9+ messages in thread
From: David Sterba @ 2019-03-01 16:41 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RESEND 1/2] btrfs-progs: check for no result before using results
  2019-03-01 16:41 ` David Sterba
@ 2019-03-02 10:19   ` Anand Jain
  0 siblings, 0 replies; 9+ messages in thread
From: Anand Jain @ 2019-03-02 10:19 UTC (permalink / raw)
  To: dsterba, linux-btrfs



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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH RESEND 1/2] btrfs-progs: check for no result before using results
@ 2019-02-22 17:43 Anand Jain
  0 siblings, 0 replies; 9+ messages in thread
From: Anand Jain @ 2019-02-22 17:43 UTC (permalink / raw)
  To: linux-btrfs

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,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH RESEND 1/2] btrfs-progs: check for no result before using results
  2019-01-16  3:13 Anand Jain
@ 2019-01-25 11:21 ` Anand Jain
  0 siblings, 0 replies; 9+ messages in thread
From: Anand Jain @ 2019-01-25 11:21 UTC (permalink / raw)
  To: linux-btrfs, dsterba



On 1/16/19 11:13 AM, 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>

  Ping.

> ---
>   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,
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH RESEND 1/2] btrfs-progs: check for no result before using results
@ 2019-01-16  3:13 Anand Jain
  2019-01-25 11:21 ` Anand Jain
  0 siblings, 1 reply; 9+ messages in thread
From: Anand Jain @ 2019-01-16  3:13 UTC (permalink / raw)
  To: linux-btrfs

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,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RESEND 1/2] btrfs-progs: check for no result before using results
@ 2019-01-08  4:09 Anand Jain
  0 siblings, 0 replies; 9+ messages in thread
From: Anand Jain @ 2019-01-08  4:09 UTC (permalink / raw)
  To: linux-btrfs

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,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-02 10:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31 10:05 [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
2019-01-31 10:05 ` [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report Anand Jain
2019-02-07 21:38 ` [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
2019-03-01 16:41 ` David Sterba
2019-03-02 10:19   ` Anand Jain
  -- strict thread matches above, loose matches on Subject: below --
2019-02-22 17:43 Anand Jain
2019-01-16  3:13 Anand Jain
2019-01-25 11:21 ` Anand Jain
2019-01-08  4:09 Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).