37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
From 2d168cd506ec0b7a7619433aa0299b0be05ce655 Mon Sep 17 00:00:00 2001
|
|
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
|
|
Date: Mon, 17 Mar 2025 12:24:58 +0100
|
|
Subject: btrfs: zoned: fix zone activation with missing devices
|
|
|
|
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>
|
|
---
|
|
fs/btrfs/zoned.c | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
--- a/fs/btrfs/zoned.c
|
|
+++ b/fs/btrfs/zoned.c
|
|
@@ -2111,6 +2111,9 @@ bool btrfs_zone_activate(struct btrfs_bl
|
|
physical = map->stripes[i].physical;
|
|
zinfo = device->zone_info;
|
|
|
|
+ if (!device->bdev)
|
|
+ continue;
|
|
+
|
|
if (zinfo->max_active_zones == 0)
|
|
continue;
|
|
|