lkml.org 
[lkml]   [2022]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.17 047/772] btrfs: zoned: zone finish unused block group
    Date
    From: Naohiro Aota <naohiro.aota@wdc.com>

    commit 74e91b12b11560f01d120751d99d91d54b265d3d upstream.

    While the active zones within an active block group are reset, and their
    active resource is released, the block group itself is kept in the active
    block group list and marked as active. As a result, the list will contain
    more than max_active_zones block groups. That itself is not fatal for the
    device as the zones are properly reset.

    However, that inflated list is, of course, strange. Also, a to-appear
    patch series, which deactivates an active block group on demand, gets
    confused with the wrong list.

    So, fix the issue by finishing the unused block group once it gets
    read-only, so that we can release the active resource in an early stage.

    Fixes: be1a1d7a5d24 ("btrfs: zoned: finish fully written block group")
    CC: stable@vger.kernel.org # 5.16+
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    fs/btrfs/block-group.c | 8 ++++++++
    1 file changed, 8 insertions(+)

    --- a/fs/btrfs/block-group.c
    +++ b/fs/btrfs/block-group.c
    @@ -1367,6 +1367,14 @@ void btrfs_delete_unused_bgs(struct btrf
    goto next;
    }

    + ret = btrfs_zone_finish(block_group);
    + if (ret < 0) {
    + btrfs_dec_block_group_ro(block_group);
    + if (ret == -EAGAIN)
    + ret = 0;
    + goto next;
    + }
    +
    /*
    * Want to do this before we do anything else so we can recover
    * properly if we fail to join the transaction.

    \
     
     \ /
      Last update: 2022-06-07 22:24    [W:3.485 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site