* [PATCH] btrfs: zoned: clear data relocation bg on zone finish
@ 2021-12-02 8:47 Johannes Thumshirn
2021-12-02 12:55 ` Naohiro Aota
2021-12-06 17:59 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2021-12-02 8:47 UTC (permalink / raw)
To: David Sterba; +Cc: Johannes Thumshirn, linux-btrfs, Naohiro Aota
When finishing a zone that is used by a dedicated data relocation
block_group, also remove its reference from fs_info, so we're not trying
to use a full block_group for allocations during data relocation, which
will always fail.
The result is we're not making any forward progress and end up in a
deadlock situation.
Cc: Naohiro Aota <Naohiro.Aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
fs/btrfs/zoned.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index c917867a4261..9cdef5e8f6b7 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -1915,6 +1915,7 @@ int btrfs_zone_finish(struct btrfs_block_group *block_group)
block_group->alloc_offset = block_group->zone_capacity;
block_group->free_space_ctl->free_space = 0;
btrfs_clear_treelog_bg(block_group);
+ btrfs_clear_data_reloc_bg(block_group);
spin_unlock(&block_group->lock);
ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH,
@@ -1997,6 +1998,7 @@ void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 len
ASSERT(block_group->alloc_offset == block_group->zone_capacity);
ASSERT(block_group->free_space_ctl->free_space == 0);
btrfs_clear_treelog_bg(block_group);
+ btrfs_clear_data_reloc_bg(block_group);
spin_unlock(&block_group->lock);
map = block_group->physical_map;
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: zoned: clear data relocation bg on zone finish
2021-12-02 8:47 [PATCH] btrfs: zoned: clear data relocation bg on zone finish Johannes Thumshirn
@ 2021-12-02 12:55 ` Naohiro Aota
2021-12-06 17:59 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Naohiro Aota @ 2021-12-02 12:55 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs
On Thu, Dec 02, 2021 at 12:47:14AM -0800, Johannes Thumshirn wrote:
> When finishing a zone that is used by a dedicated data relocation
> block_group, also remove its reference from fs_info, so we're not trying
> to use a full block_group for allocations during data relocation, which
> will always fail.
>
> The result is we're not making any forward progress and end up in a
> deadlock situation.
>
> Cc: Naohiro Aota <Naohiro.Aota@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Looks good.
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
> fs/btrfs/zoned.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index c917867a4261..9cdef5e8f6b7 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -1915,6 +1915,7 @@ int btrfs_zone_finish(struct btrfs_block_group *block_group)
> block_group->alloc_offset = block_group->zone_capacity;
> block_group->free_space_ctl->free_space = 0;
> btrfs_clear_treelog_bg(block_group);
> + btrfs_clear_data_reloc_bg(block_group);
> spin_unlock(&block_group->lock);
>
> ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH,
> @@ -1997,6 +1998,7 @@ void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 len
> ASSERT(block_group->alloc_offset == block_group->zone_capacity);
> ASSERT(block_group->free_space_ctl->free_space == 0);
> btrfs_clear_treelog_bg(block_group);
> + btrfs_clear_data_reloc_bg(block_group);
> spin_unlock(&block_group->lock);
>
> map = block_group->physical_map;
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: zoned: clear data relocation bg on zone finish
2021-12-02 8:47 [PATCH] btrfs: zoned: clear data relocation bg on zone finish Johannes Thumshirn
2021-12-02 12:55 ` Naohiro Aota
@ 2021-12-06 17:59 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2021-12-06 17:59 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs, Naohiro Aota
On Thu, Dec 02, 2021 at 12:47:14AM -0800, Johannes Thumshirn wrote:
> When finishing a zone that is used by a dedicated data relocation
> block_group, also remove its reference from fs_info, so we're not trying
> to use a full block_group for allocations during data relocation, which
> will always fail.
>
> The result is we're not making any forward progress and end up in a
> deadlock situation.
>
> Cc: Naohiro Aota <Naohiro.Aota@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-06 17:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 8:47 [PATCH] btrfs: zoned: clear data relocation bg on zone finish Johannes Thumshirn
2021-12-02 12:55 ` Naohiro Aota
2021-12-06 17:59 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).