Skip to content

Commit

Permalink
btrfs: warn about dev extents that are inside the reserved range
Browse files Browse the repository at this point in the history
Btrfs on-disk format has reserved the first 1MiB for the primary super
block (at 64KiB offset) and bootloaders may also use this space.

This behavior is only introduced since v4.1 btrfs-progs release,
although kernel can ensure we never touch the reserved range of super
blocks, it's better to inform the end users, and a balance will resolve
the problem.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[ update changelog and message ]
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Qu Wenruo authored and David Sterba committed Jul 25, 2022
1 parent 37f85ec commit 3613249
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -7996,6 +7996,16 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
goto out;
}

/*
* Very old mkfs.btrfs (before v4.1) will not respect the reserved
* space. Although kernel can handle it without problem, better to warn
* the users.
*/
if (physical_offset < BTRFS_DEVICE_RANGE_RESERVED)
btrfs_warn(fs_info,
"devid %llu physical %llu len %llu inside the reserved space",
devid, physical_offset, physical_len);

for (i = 0; i < map->num_stripes; i++) {
if (map->stripes[i].dev->devid == devid &&
map->stripes[i].physical == physical_offset) {
Expand Down

0 comments on commit 3613249

Please sign in to comment.