Re: [PATCH] btrfs: extent-tree: Fix a bug that btrfs is unable to add pinned bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 10, 2019 at 12:45:05PM +0800, Qu Wenruo wrote:
> Commit ddf30cf03fb5 ("btrfs: extent-tree: Use btrfs_ref to refactor
> add_pinned_bytes()") refactored add_pinned_bytes(), but during that
> refactor, there are two callers which add the pinned bytes instead
> of subtracting.
> 
> That refactor misses those two caller, causing incorrect pinned bytes
> calculation and resulting unexpected ENOSPC error.
> 
> Fix it by adding a new parameter @sign to restore the original behavior.
> 
> Reported-by: kernel test robot <rong.a.chen@xxxxxxxxx>
> Fixes: ddf30cf03fb5 ("btrfs: extent-tree: Use btrfs_ref to refactor add_pinned_bytes()")
> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
> ---
>  fs/btrfs/extent-tree.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index f79e477a378e..8592d31e321c 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -757,12 +757,14 @@ static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info,
>  }
>  
>  static void add_pinned_bytes(struct btrfs_fs_info *fs_info,
> -			     struct btrfs_ref *ref)
> +			     struct btrfs_ref *ref, int sign)

This does not look like a good API, can it be done with a separate
function like sub_pinned_bytes?



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux