mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-21 21:12:55 +00:00
btrfs-progs: fix check to catch gaps at the start of the file
When writing my test for the i_size patches, I noticed that I was not actually failing without my patches as I should have been. This is because we only check if the inode record extent end is < isize, we don't check if the inode record extent start is > 0. Add this check to make sure we're catching holes that start at the beginning of the file. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
fae40e9d73
commit
9123fc6142
@ -826,8 +826,9 @@ static void maybe_free_inode_rec(struct cache_tree *inode_cache,
|
||||
/* Orphan inodes don't have correct nbytes */
|
||||
if (rec->nlink > 0 && rec->found_size != rec->nbytes)
|
||||
rec->errors |= I_ERR_FILE_NBYTES_WRONG;
|
||||
if (rec->nlink > 0 && !no_holes &&
|
||||
if (rec->nlink > 0 && !no_holes && rec->isize &&
|
||||
(rec->extent_end < rec->isize ||
|
||||
rec->extent_start != 0 ||
|
||||
first_extent_gap(&rec->holes) < rec->isize))
|
||||
rec->errors |= I_ERR_FILE_EXTENT_DISCOUNT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user