]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: extent-tree: Fix a bug that btrfs is unable to add pinned bytes
authorQu Wenruo <wqu@suse.com>
Fri, 10 May 2019 04:45:05 +0000 (12:45 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 16 May 2019 12:31:13 +0000 (14:31 +0200)
commitd069ab1a5aa2effec53bfdcee08d44e3326e88c1
treeb003ed219dcbbe322a3ce6f5bf4817364b392bb8
parenta30594e41741c4cdbb8af5c25f6209bd45cf8423
btrfs: extent-tree: Fix a bug that btrfs is unable to add pinned bytes

Commit d5a6ac2d88d5 ("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@intel.com>
Fixes: d5a6ac2d88d5 ("btrfs: extent-tree: Use btrfs_ref to refactor add_pinned_bytes()")
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c