mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-30 06:57:55 +00:00
btrfs-progs: handle balance and replace concurrency
Starting device replace and balance does not properly report the status. 1. start replace: $ btrfs replace start -B -f /dev/sdd /dev/sdb /btrfs 2. while replace is still running, from another terminal try to start balance: $ btrfs balance start --full-balance /btrfs Done, had to relocate 0 out of 0 chunks This returns with exit code 0, which fails to report that balance failed to start because another exclusive operation is running. In fact kernel ioctl BTRFS_IOC_BALANCE(_V2) does return error code 8, but it's incorrectly reset to 0. Fix it by checking for the error code > 0. After: $ btrfs balance start --full-balance /btrfs ERROR: balance: add/delete/balance/replace/resize operation in progress Signed-off-by: Anand Jain <anand.jain@oracle.com> [ update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ccdd01a404
commit
aca8193adb
@ -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");
|
"There may be more info in syslog - try dmesg | tail\n");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
} else if (ret > 0) {
|
||||||
|
error("balance: %s", btrfs_err_str(ret));
|
||||||
} else {
|
} else {
|
||||||
printf("Done, had to relocate %llu out of %llu chunks\n",
|
printf("Done, had to relocate %llu out of %llu chunks\n",
|
||||||
(unsigned long long)args->stat.completed,
|
(unsigned long long)args->stat.completed,
|
||||||
(unsigned long long)args->stat.considered);
|
(unsigned long long)args->stat.considered);
|
||||||
ret = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
Loading…
Reference in New Issue
Block a user