Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 381a696

Browse files
naotakdave
authored andcommitted
btrfs: zoned: verify device extent is aligned to zone
Add a check in verify_one_dev_extent() to ensure that a device extent on a zoned block device is aligned to the respective zone boundary. If it isn't, mark the filesystem as unclean. Reviewed-by: Anand Jain <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Naohiro Aota <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 1cd6121 commit 381a696

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

fs/btrfs/volumes.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7769,6 +7769,20 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
77697769
ret = -EUCLEAN;
77707770
goto out;
77717771
}
7772+
7773+
if (dev->zone_info) {
7774+
u64 zone_size = dev->zone_info->zone_size;
7775+
7776+
if (!IS_ALIGNED(physical_offset, zone_size) ||
7777+
!IS_ALIGNED(physical_len, zone_size)) {
7778+
btrfs_err(fs_info,
7779+
"zoned: dev extent devid %llu physical offset %llu len %llu is not aligned to device zone",
7780+
devid, physical_offset, physical_len);
7781+
ret = -EUCLEAN;
7782+
goto out;
7783+
}
7784+
}
7785+
77727786
out:
77737787
free_extent_map(em);
77747788
return ret;

0 commit comments

Comments
 (0)