Skip to content

Commit c1e6d4b

Browse files
Christoph Hellwiggregkh
authored andcommitted
btrfs: zoned: fix missing endianness conversion in sb_write_pointer
commit c51f0e6 upstream. generation is an on-disk __le64 value, so use btrfs_super_generation to convert it to host endian before comparing it. Fixes: 1265925 ("btrfs: implement log-structured superblock for ZONED mode") CC: [email protected] # 5.15+ Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d88bf6b commit c1e6d4b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/zoned.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,
114114
super[i] = page_address(page[i]);
115115
}
116116

117-
if (super[0]->generation > super[1]->generation)
117+
if (btrfs_super_generation(super[0]) >
118+
btrfs_super_generation(super[1]))
118119
sector = zones[1].start;
119120
else
120121
sector = zones[0].start;

0 commit comments

Comments
 (0)