mbox series

[0/2] btrfs: zoned: fix zone management on degraded filesystems

Message ID cover.1742210138.git.jth@kernel.org (mailing list archive)
Headers show
Series btrfs: zoned: fix zone management on degraded filesystems | expand

Message

Johannes Thumshirn March 17, 2025, 11:24 a.m. UTC
Two fixes around ZONE FINISH and ZONE ACTIVATE for multi device filesystems in
degraded mode.

Both times we're dereferencing the btrfs_device::zone_info pointer without
prior checking if the device is present.

Johannes Thumshirn (2):
  btrfs: zoned: fix zone activation with missing devices
  btrfs: zoned: fix zone finishing with missing devices

 fs/btrfs/zoned.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Naohiro Aota March 18, 2025, 1:27 a.m. UTC | #1
On Mon Mar 17, 2025 at 8:24 PM JST, Johannes Thumshirn wrote:
> Two fixes around ZONE FINISH and ZONE ACTIVATE for multi device filesystems in
> degraded mode.
>
> Both times we're dereferencing the btrfs_device::zone_info pointer without
> prior checking if the device is present.

At first, I thought, we should not write into a block group containing a
missing device. But, yeah, in the degraded mode, we are allowed to make
un-synced writing.

So, for the series

Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>

>
> Johannes Thumshirn (2):
>   btrfs: zoned: fix zone activation with missing devices
>   btrfs: zoned: fix zone finishing with missing devices
>
>  fs/btrfs/zoned.c | 6 ++++++
>  1 file changed, 6 insertions(+)
Anand Jain March 18, 2025, 10:10 a.m. UTC | #2
On 17/3/25 19:24, Johannes Thumshirn wrote:
> Two fixes around ZONE FINISH and ZONE ACTIVATE for multi device filesystems in
> degraded mode.
> 
> Both times we're dereferencing the btrfs_device::zone_info pointer without
> prior checking if the device is present.
> 
> Johannes Thumshirn (2):
>    btrfs: zoned: fix zone activation with missing devices
>    btrfs: zoned: fix zone finishing with missing devices
> 
>   fs/btrfs/zoned.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 

Looks good for now.

Reviewed-by: Anand Jain <anand.jain@oracle.com>


PS:
We have been using either of these methods to identify the
missing device.

   test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)

or

   device->bdev == NULL

IMO, it's a good idea to consolidate to the BTRFS_DEV_STATE_MISSING
flag. I have some incomplete patches for that. Also, I think we
should discuss how to handle reappearing devices;

Thanks, Anand