Hi David,

Please ignore this patchset.

The fix can only reduce the possibility of the problem, but not really
fix it.

Although the root cause of the problem is still pretty the same, that
btrfs_delete_unused_bgs() deletes some block groups still in usage.

However it's not just about the transid.
It's about the block_group->pinned bytes.

Currently btrfs_delete_unused_bgs() only uses used_bytes in block group
item, while it's still possible for delalloc to pin down some metadata
bytes several transactions ago.

In that case, delayed block group auto removal won't help much.

The true fix should teach btrfs_delete_unused_bgs() to skip block groups
with pinned bytes.

I'll send another fix for this bug.

Thanks,
Qu

On 2018年05月30日 12:40, Qu Wenruo wrote:
> The patchset can be fetched from github:
> https://github.com/adam900710/linux/tree/delayed_bg_removal
> 
> It's based on David's misc-next branch, HEAD is:
> commit c77a75861d82a497bd1a26054588cd9af59eb5db (david/misc-next)
> Author: Ethan Lien <ethanl...@synology.com>
> Date:   Mon May 28 13:48:20 2018 +0800
> 
>     btrfs: balance dirty metadata pages in btrfs_finish_ordered_io
> 
> 
> This bug is reported from SUSE openQA, although it's pretty hard to hit
> in real world (even real world VM), it's believed block group auto
> removal (anyway, there isn't much thing can remove a chunk mapping in
> btrfs) could interfere with qgroup's search on commit root.
> 
> Full details can be found in the 2rd patch.
> 
> The patchset uses 1 submitted cleanup/refactor patches as basis, and the
> 2nd patch will ensure unused block group will only be deleted after
> current transaction is done.
> 
> 
> Qu Wenruo (2):
>   btrfs: Use btrfs_mark_bg_unused() to replace open code
>   btrfs: Delayed empty block group auto removal to next transaction
> 
>  fs/btrfs/ctree.h       |  2 ++
>  fs/btrfs/extent-tree.c | 62 +++++++++++++++++++++++++++++-------------
>  fs/btrfs/scrub.c       |  9 +-----
>  fs/btrfs/transaction.c |  7 +++++
>  fs/btrfs/transaction.h | 10 +++++++
>  5 files changed, 63 insertions(+), 27 deletions(-)
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to