* [PATCH] btrfs-progs: handle balance and replace concurrency
@ 2018-12-18 16:01 Anand Jain
2019-01-15 17:32 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Anand Jain @ 2018-12-18 16:01 UTC (permalink / raw)
To: linux-btrfs
Test case:
Run replace
btrfs repl start -B -f /dev/sdd /dev/sdb /btrfs;
while replace is still running, from another terminal try to start
balance
btrfs bal start --full-balance /btrfs; echo ...:$?
Done, had to relocate 0 out of 0 chunks
...:0
which fails to report that balance failed to relocate because another
exclusive operation is running.
In fact kernel ioctl BTRFS_IOC_BALANCE(_V2) does return error code 8,
but progs recast it to 0. Fix it by checking for the error code > 0.
After:
btrfs bal start --full-balance /btrfs; echo ...:$?
ERROR: balance: add/delete/balance/replace/resize operation in progress
...:8
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
cmds-balance.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmds-balance.c b/cmds-balance.c
index 6cc26c358f95..77402ef62d85 100644
--- a/cmds-balance.c
+++ b/cmds-balance.c
@@ -481,11 +481,12 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args,
"There may be more info in syslog - try dmesg | tail\n");
ret = 1;
}
+ } else if (ret > 0) {
+ error("balance: %s", btrfs_err_str(ret));
} else {
printf("Done, had to relocate %llu out of %llu chunks\n",
(unsigned long long)args->stat.completed,
(unsigned long long)args->stat.considered);
- ret = 0;
}
out:
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs-progs: handle balance and replace concurrency
2018-12-18 16:01 [PATCH] btrfs-progs: handle balance and replace concurrency Anand Jain
@ 2019-01-15 17:32 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2019-01-15 17:32 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs
On Wed, Dec 19, 2018 at 12:01:44AM +0800, Anand Jain wrote:
> Test case:
> Run replace
> btrfs repl start -B -f /dev/sdd /dev/sdb /btrfs;
> while replace is still running, from another terminal try to start
> balance
> btrfs bal start --full-balance /btrfs; echo ...:$?
> Done, had to relocate 0 out of 0 chunks
> ...:0
>
> which fails to report that balance failed to relocate because another
> exclusive operation is running.
> In fact kernel ioctl BTRFS_IOC_BALANCE(_V2) does return error code 8,
> but progs recast it to 0. Fix it by checking for the error code > 0.
>
> After:
> btrfs bal start --full-balance /btrfs; echo ...:$?
> ERROR: balance: add/delete/balance/replace/resize operation in progress
> ...:8
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-15 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 16:01 [PATCH] btrfs-progs: handle balance and replace concurrency Anand Jain
2019-01-15 17:32 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.