]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix wrong file range cleanup after an error filling dealloc range
authorFilipe Manana <fdmanana@suse.com>
Wed, 27 May 2020 10:15:53 +0000 (11:15 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 28 May 2020 12:01:53 +0000 (14:01 +0200)
commit35c85145a25e8c6954e17a75365528c0160e18b5
tree50e15443414ead3a23603bcae164af274c2eb317
parent061bc6e4d52e2e04541adc157a0be00f3c465f41
btrfs: fix wrong file range cleanup after an error filling dealloc range

If an error happens while running dellaloc in COW mode for a range, we can
end up calling extent_clear_unlock_delalloc() for a range that goes beyond
our range's end offset by 1 byte, which affects 1 extra page. This results
in clearing bits and doing page operations (such as a page unlock) outside
our target range.

Fix that by calling extent_clear_unlock_delalloc() with an inclusive end
offset, instead of an exclusive end offset, at cow_file_range().

Fixes: 4f9ebee7b73b61 ("Btrfs: fix invalid attempt to free reserved space on failure to cow range")
CC: stable@vger.kernel.org # 4.14+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c