Skip to content

Commit 35fec10

Browse files
morbidrsakdave
authored andcommitted
btrfs: zoned: fix zone finishing with missing devices
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: 4dcbb8a ("btrfs: zoned: make zone finishing multi stripe capable") CC: [email protected] # 6.1+ Reviewed-by: Naohiro Aota <[email protected]> Reviewed-by: Anand Jain <[email protected]> Signed-off-by: Johannes Thumshirn <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 2bbc4a4 commit 35fec10

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/btrfs/zoned.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,9 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
22752275
struct btrfs_zoned_device_info *zinfo = device->zone_info;
22762276
unsigned int nofs_flags;
22772277

2278+
if (!device->bdev)
2279+
continue;
2280+
22782281
if (zinfo->max_active_zones == 0)
22792282
continue;
22802283

0 commit comments

Comments
 (0)