]> git.hungrycats.org Git - linux/commit
btrfs: zoned: fix full zone super block reading on ZNS
authorNaohiro Aota <Naohiro.Aota@wdc.com>
Tue, 9 May 2023 18:29:15 +0000 (18:29 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 11:58:58 +0000 (13:58 +0200)
commit180b81b0947e8030ff78d60e54e73e1eb3791232
tree4869a5e3d0a22833c04bc1d64baadddbcacd0c73
parenta37fc1ee63b81d7ef64c688e7728200eca1ce19b
btrfs: zoned: fix full zone super block reading on ZNS

commit 02ca9e6fb5f66a031df4fac508b8e477ca69e918 upstream.

When both of the superblock zones are full, we need to check which
superblock is newer. The calculation of last superblock position is wrong
as it does not consider zone_capacity and uses the length.

Fixes: 9658b72ef300 ("btrfs: zoned: locate superblock position using zone capacity")
CC: stable@vger.kernel.org # 6.1+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/zoned.c