From: Johannes Thumshirn <jth@kernel.org>
To: linux-btrfs@vger.kernel.org
Cc: Naohiro Aota <naohiro.aota@wdc.com>,
Damien Le Moal <dlemoal@kernel.org>,
Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH 1/2] btrfs: zoned: fix zone activation with missing devices
Date: Mon, 17 Mar 2025 12:24:58 +0100 [thread overview]
Message-ID: <5a221a55c0a170aa6073b997a160d94f9880e40e.1742210138.git.jth@kernel.org> (raw)
In-Reply-To: <cover.1742210138.git.jth@kernel.org>
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
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")
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
fs/btrfs/zoned.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index c21a97b32f9a..8924f58919e8 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -2110,6 +2110,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;
--
2.43.0
next prev parent reply other threads:[~2025-03-17 11:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 11:24 [PATCH 0/2] btrfs: zoned: fix zone management on degraded filesystems Johannes Thumshirn
2025-03-17 11:24 ` Johannes Thumshirn [this message]
2025-03-17 11:24 ` [PATCH 2/2] btrfs: zoned: fix zone finishing with missing devices Johannes Thumshirn
2025-03-18 1:27 ` [PATCH 0/2] btrfs: zoned: fix zone management on degraded filesystems Naohiro Aota
2025-03-18 10:10 ` Anand Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a221a55c0a170aa6073b997a160d94f9880e40e.1742210138.git.jth@kernel.org \
--to=jth@kernel.org \
--cc=dlemoal@kernel.org \
--cc=dsterba@suse.com \
--cc=johannes.thumshirn@wdc.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox