]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: zoned: fix zone finishing with missing devices
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Mon, 17 Mar 2025 11:24:59 +0000 (12:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:18:15 +0000 (10:18 +0200)
commit403596dce50ec31dd064faf882ac8dfec19eeb83
treee3faf9a9eedd6e104bc1966029b76e53f167f835
parenta7a323b8713a529c05bf99cb985b87f8a8ba2eb0
btrfs: zoned: fix zone finishing with missing devices

commit 35fec1089ebb5617f85884d3fa6a699ce6337a75 upstream.

If do_zone_finish() is called with a filesystem that has missing devices
(e.g. a RAID file system mounted in degraded mode) it is accessing the
btrfs_device::zone_info pointer, which will not be set if the device
in question is missing.

Check if the device is present (by checking if it has a valid block device
pointer associated) and if not, skip zone finishing for it.

Fixes: 4dcbb8ab31c1 ("btrfs: zoned: make zone finishing multi stripe capable")
CC: stable@vger.kernel.org # 6.1+
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/zoned.c