diff options
author | Christoph Hellwig <hch@lst.de> | 2022-11-15 10:39:44 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-11-21 14:40:40 +0100 |
commit | c51f0e6a1254b3ac2d308e1c6fd8fb936992b455 (patch) | |
tree | 03b9601997fca4fff9f0ad47e525a25cacb59132 /fs/btrfs/zoned.c | |
parent | btrfs: free btrfs_path before copying subvol info to userspace (diff) | |
download | linux-c51f0e6a1254b3ac2d308e1c6fd8fb936992b455.tar.xz linux-c51f0e6a1254b3ac2d308e1c6fd8fb936992b455.zip |
btrfs: zoned: fix missing endianness conversion in sb_write_pointer
generation is an on-disk __le64 value, so use btrfs_super_generation to
convert it to host endian before comparing it.
Fixes: 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")
CC: stable@vger.kernel.org # 5.15+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/zoned.c')
-rw-r--r-- | fs/btrfs/zoned.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 1912abf6d020..44d8177eeffc 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -134,7 +134,8 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones, super[i] = page_address(page[i]); } - if (super[0]->generation > super[1]->generation) + if (btrfs_super_generation(super[0]) > + btrfs_super_generation(super[1])) sector = zones[1].start; else sector = zones[0].start; |