diff options
| author | Naohiro Aota <[email protected]> | 2021-05-27 06:27:32 +0000 |
|---|---|---|
| committer | David Sterba <[email protected]> | 2021-06-04 11:11:50 +0000 |
| commit | 5b434df8778771d181bc19fb4593bca114d1c4eb (patch) | |
| tree | 7624ad69ad0208990c115a9794e72341f5347758 /fs/btrfs/tree-log.c | |
| parent | btrfs: do not write supers if we have an fs error (diff) | |
| download | kernel-5b434df8778771d181bc19fb4593bca114d1c4eb.tar.gz kernel-5b434df8778771d181bc19fb4593bca114d1c4eb.zip | |
btrfs: zoned: fix zone number to sector/physical calculation
In btrfs_get_dev_zone_info(), we have "u32 sb_zone" and calculate "sector_t
sector" by shifting it. But, this "sector" is calculated in 32bit, leading
it to be 0 for the 2nd superblock copy.
Since zone number is u32, shifting it to sector (sector_t) or physical
address (u64) can easily trigger a missing cast bug like this.
This commit introduces helpers to convert zone number to sector/LBA, so we
won't fall into the same pitfall again.
Reported-by: Dmitry Fomichev <[email protected]>
Fixes: 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")
CC: [email protected] # 5.11+
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Naohiro Aota <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/tree-log.c')
0 files changed, 0 insertions, 0 deletions
