Filipe Manana 789555b22b btrfs: fix wrong file range cleanup after an error filling dealloc range
[ Upstream commit e2c8e92d1140754073ad3799eb6620c76bab2078 ]

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: a315e68f6e8b30 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-22 09:05:26 +02:00
..
2020-04-02 15:28:19 +02:00
2019-08-06 19:06:51 +02:00
2019-12-13 08:52:23 +01:00
2019-12-13 08:52:36 +01:00
2018-08-17 16:20:28 -07:00
2019-12-13 08:51:59 +01:00
2018-08-17 16:20:27 -07:00
2018-08-18 11:44:53 -07:00
2020-06-22 09:05:01 +02:00
2020-03-05 16:42:12 +01:00
2018-08-21 18:19:09 -07:00
2020-03-25 08:06:14 +01:00