diff options
author | Qu Wenruo <wqu@suse.com> | 2018-04-30 14:16:59 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-06-07 16:37:33 +0200 |
commit | 4bd7bbb6f6859583da1a81406cb3c02d613c9b2c (patch) | |
tree | e245c9254672712296f3d8d24b69f2688c0b1cfd /check/main.c | |
parent | 9f8316f1c870415383d8761e1455f1375e2e00b0 (diff) |
btrfs-progs: check: Make btrfs check return error for qgroup mismatch
Current btrfs-check will check qgroup consistency, but even when it
finds something wrong, the return value is still 0.
Fix it by allowing report_qgroups() to return int to indicate qgroup
mismatch, and also add extra logic to return no error if qgroup repair
is successful.
Without this patch, fstests can't detect qgroup corruption by its fsck
alone.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'check/main.c')
-rw-r--r-- | check/main.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/check/main.c b/check/main.c index 2465d2b7..96501110 100644 --- a/check/main.c +++ b/check/main.c @@ -9410,6 +9410,7 @@ int cmd_check(int argc, char **argv) int clear_space_cache = 0; int qgroup_report = 0; int qgroups_repaired = 0; + int qgroup_report_ret; unsigned ctree_flags = OPEN_CTREE_EXCLUSIVE; int force = 0; @@ -9652,7 +9653,7 @@ int cmd_check(int argc, char **argv) ret = qgroup_verify_all(info); err |= !!ret; if (ret == 0) - report_qgroups(1); + err |= !!report_qgroups(1); goto close_out; } if (subvolid) { @@ -9844,13 +9845,14 @@ int cmd_check(int argc, char **argv) error("failed to check quota groups"); goto out; } - report_qgroups(0); + qgroup_report_ret = report_qgroups(0); ret = repair_qgroups(info, &qgroups_repaired); - err |= !!ret; - if (err) { + if (ret) { error("failed to repair quota groups"); goto out; } + if (qgroup_report_ret && (!qgroups_repaired || ret)) + err |= qgroup_report_ret; ret = 0; } |