From: Johannes Thumshirn Date: Mon, 17 Mar 2025 11:24:58 +0000 (+0100) Subject: btrfs: zoned: fix zone activation with missing devices X-Git-Tag: v6.6.88~205 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa55f2a31ba234dc58e9fd8215b0221fbf0b9f57;p=platform%2Fkernel%2Flinux-riscv.git 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 Reviewed-by: Anand Jain Signed-off-by: Johannes Thumshirn Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index c4463c3f2068..f2662ffcb72c 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2006,6 +2006,9 @@ bool btrfs_zone_activate(struct btrfs_block_group *block_group) physical = map->stripes[i].physical; zinfo = device->zone_info; + if (!device->bdev) + continue; + if (zinfo->max_active_zones == 0) continue;