]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: zoned: fix zone activation with missing devices
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Mon, 17 Mar 2025 11:24:58 +0000 (12:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 08:45:30 +0000 (10:45 +0200)
commitfa55f2a31ba234dc58e9fd8215b0221fbf0b9f57
treee3ab52bbc62532d78daf7403d07a33c9f7ca79e2
parent897ad7f70dd7d8e9dc3277b52c15b88284e2f90d
btrfs: zoned: fix zone activation with missing devices

commit 2bbc4a45e5eb6b868357c1045bf6f38f6ba576e0 upstream.

If btrfs_zone_activate() 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 activation for it.

Fixes: f9a912a3c45f ("btrfs: zoned: make zone activation 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