Fix incorrect splitting logic in btrfs_drop_extent_map_range
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | btrfs: fix incorrect splitting in btrfs_drop_extent_map_rangefs/ | +2 | 1 reply | |
| 2/4 | btrfs: add extent_map tests for dropping with odd layoutsfs/ | +219 | 1 reply | |
| 3/4 | btrfs: add a self test for btrfs_add_extent_mappingfs/ | +57 | 1 reply | |
| 4/4 | btrfs: test invalid splitting when skipping pinned drop extent_mapfs/ | +138 | 1 reply |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Filipe Manana |
|---|---|
| 1/4 | R-b |
| 2/4 | R-b |
| 3/4 | R-b |
| 4/4 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/4] Fix incorrect splitting logic in btrfs_drop_extent_map_range
We have been hitting a fair number of warnings in btrfs_drop_extent_map_range and in unpin_extent_map in production. Upon investigation I discovered we were splitting improperly when we call btrfs_drop_extent_map_range with skip_pinned. This results in invalid extent_maps in the inode's io_tree, which in turn wreaks all sorts of havoc, mostly in the form of these WARN_ON()'s. This took me a while to spot so I have a bunch of self-tests that test various functionality of btrfs_drop_extent_map_range and btrfs_add_extent_mapping, with one test that actual exercises the bug.
This has been broken for a while, and thankfully is only triggered in certain cases with relocation on. Our environment uses auto relocation heavily which is why we hit this reliably, but the incident rate is still relatively low. The bug was introduced over 10 years ago, it probably could be limited to being backported to the most recent kernels, basically anytime after Filipe's cleaning up of this code. Thanks,
Josef
Josef Bacik (4):
btrfs: fix incorrect splitting in btrfs_drop_extent_map_range
btrfs: add extent_map tests for dropping with odd layouts
btrfs: add a self test for btrfs_add_extent_mapping
btrfs: test invalid splitting when skipping pinned drop extent_map
fs/btrfs/extent_map.c | 6 +- fs/btrfs/tests/extent-map-tests.c | 414 ++++++++++++++++++++++++++++++ 2 files changed, 416 insertions(+), 4 deletions(-)
Signature · 1 line
2.26.3