Message ID | 775807e6c1507c1ec4c32d993fb1cd3222fe3853.1727732460.git.loemra.dev@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: mkfs free-space-info bug | expand |
diff --git a/common/clear-cache.c b/common/clear-cache.c index 6493866d..09ef5741 100644 --- a/common/clear-cache.c +++ b/common/clear-cache.c @@ -165,7 +165,8 @@ static int check_free_space_tree(struct btrfs_root *root) } bg = btrfs_lookup_first_block_group(fs_info, key.objectid); - if (!bg) { + if (!bg || key.objectid != bg->start || + key.offset != bg->length) { fprintf(stderr, "We have a space info key for a block group that doesn't exist\n"); ret = -EINVAL;
Check that the block-group that is found matches the objectid and offset of the free-space-info. Without this the check only verifies that there is some block-group that exists with objectid >= free-space-info's objectid. To reiterate what I mentioned in the cover letter this will cause all filesystems created with mkfs.btrfs to print this warning. Signed-off-by: Leo Martins <loemra.dev@gmail.com> --- common/clear-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)