mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-22 14:13:04 +00:00
btrfs-progs: Fix return value bug of qgroups check
Before this patch, although btrfsck will check qgroups if quota is enabled, it always return 0 even qgroup numbers are corrupted. Fix it by allowing return value from report_qgroups function (formally defined as print_qgroup_difference). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
b652aeeb38
commit
f172bd2b8d
@ -9671,7 +9671,7 @@ int cmd_check(int argc, char **argv)
|
|||||||
uuidbuf);
|
uuidbuf);
|
||||||
ret = qgroup_verify_all(info);
|
ret = qgroup_verify_all(info);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
print_qgroup_report(1);
|
ret = report_qgroups(1);
|
||||||
goto close_out;
|
goto close_out;
|
||||||
}
|
}
|
||||||
if (subvolid) {
|
if (subvolid) {
|
||||||
@ -9832,7 +9832,11 @@ int cmd_check(int argc, char **argv)
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
print_qgroup_report(0);
|
/* Don't override original ret */
|
||||||
|
if (ret)
|
||||||
|
report_qgroups(0);
|
||||||
|
else
|
||||||
|
ret = report_qgroups(0);
|
||||||
if (found_old_backref) { /*
|
if (found_old_backref) { /*
|
||||||
* there was a disk format change when mixed
|
* there was a disk format change when mixed
|
||||||
* backref was in testing tree. The old format
|
* backref was in testing tree. The old format
|
||||||
|
@ -1016,7 +1016,7 @@ static void print_fields_signed(long long bytes,
|
|||||||
prefix, type, bytes, type, bytes_compressed);
|
prefix, type, bytes, type, bytes_compressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_qgroup_difference(struct qgroup_count *count, int verbose)
|
static int report_qgroup_difference(struct qgroup_count *count, int verbose)
|
||||||
{
|
{
|
||||||
int is_different;
|
int is_different;
|
||||||
struct qgroup_info *info = &count->info;
|
struct qgroup_info *info = &count->info;
|
||||||
@ -1046,19 +1046,22 @@ static void print_qgroup_difference(struct qgroup_count *count, int verbose)
|
|||||||
print_fields_signed(excl_diff, excl_diff,
|
print_fields_signed(excl_diff, excl_diff,
|
||||||
"diff:", "exclusive");
|
"diff:", "exclusive");
|
||||||
}
|
}
|
||||||
|
return (is_different && count->subvol_exists);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_qgroup_report(int all)
|
int report_qgroups(int all)
|
||||||
{
|
{
|
||||||
struct rb_node *node;
|
struct rb_node *node;
|
||||||
struct qgroup_count *c;
|
struct qgroup_count *c;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
node = rb_first(&counts.root);
|
node = rb_first(&counts.root);
|
||||||
while (node) {
|
while (node) {
|
||||||
c = rb_entry(node, struct qgroup_count, rb_node);
|
c = rb_entry(node, struct qgroup_count, rb_node);
|
||||||
print_qgroup_difference(c, all);
|
ret |= report_qgroup_difference(c, all);
|
||||||
node = rb_next(node);
|
node = rb_next(node);
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int qgroup_verify_all(struct btrfs_fs_info *info)
|
int qgroup_verify_all(struct btrfs_fs_info *info)
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "ctree.h"
|
#include "ctree.h"
|
||||||
|
|
||||||
int qgroup_verify_all(struct btrfs_fs_info *info);
|
int qgroup_verify_all(struct btrfs_fs_info *info);
|
||||||
void print_qgroup_report(int all);
|
int report_qgroups(int all);
|
||||||
|
|
||||||
int print_extent_state(struct btrfs_fs_info *info, u64 subvol);
|
int print_extent_state(struct btrfs_fs_info *info, u64 subvol);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user