[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b677188b-b41b-4a3d-8598-61e8ccdef075@gmx.com>
Date: Tue, 8 Oct 2024 18:25:58 +1030
From: Qu Wenruo <quwenruo.btrfs@....com>
To: iamhswang@...il.com, linux-btrfs@...r.kernel.org
Cc: clm@...com, josef@...icpanda.com, dsterba@...e.com, wqu@...e.com,
boris@....io, linux-kernel@...r.kernel.org,
Haisu Wang <haisuwang@...cent.com>
Subject: Re: [PATCH] btrfs: fix the length of reserved qgroup to free
在 2024/10/8 17:18, iamhswang@...il.com 写道:
> From: Haisu Wang <haisuwang@...cent.com>
>
> The dealloc flag may be cleared and the extent won't reach the disk
> in cow_file_range when errors path. The reserved qgroup space is
> freed in commit 30479f31d44d ("btrfs: fix qgroup reserve leaks in
> cow_file_range"). However, the length of untouched region to free
> need to be adjusted with the region size.
>
> Fixes: 30479f31d44d ("btrfs: fix qgroup reserve leaks in cow_file_range")
> Signed-off-by: Haisu Wang <haisuwang@...cent.com>
Right, just several lines before that, we increased @start by
@cur_alloc_size if @extent_reserved is true.
So we can not directly use the old range size.
You can improve that one step further by not modifying @start just for
the error handling path, although that should be another patch.
Reviewed-by: Qu Wenruo <wqu@...e.com>
Thanks,
Qu
> ---
> fs/btrfs/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index b0ad46b734c3..5eefa2318fa8 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -1592,7 +1592,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
> clear_bits |= EXTENT_CLEAR_DATA_RESV;
> extent_clear_unlock_delalloc(inode, start, end, locked_folio,
> &cached, clear_bits, page_ops);
> - btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
> + btrfs_qgroup_free_data(inode, NULL, start, end - start + 1, NULL);
> }
> return ret;
> }
Powered by blists - more mailing lists