From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 0/4] Fix incorrect splitting logic in btrfs_drop_extent_map_range
Date: Thu, 17 Aug 2023 16:57:29 -0400 [thread overview]
Message-ID: <cover.1692305624.git.josef@toxicpanda.com> (raw)
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(-)
--
2.26.3
next reply other threads:[~2023-08-17 20:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 20:57 Josef Bacik [this message]
2023-08-17 20:57 ` [PATCH 1/4] btrfs: fix incorrect splitting in btrfs_drop_extent_map_range Josef Bacik
2023-08-18 10:46 ` Filipe Manana
2023-08-17 20:57 ` [PATCH 2/4] btrfs: add extent_map tests for dropping with odd layouts Josef Bacik
2023-08-18 10:47 ` Filipe Manana
2023-08-17 20:57 ` [PATCH 3/4] btrfs: add a self test for btrfs_add_extent_mapping Josef Bacik
2023-08-18 10:48 ` Filipe Manana
2023-08-17 20:57 ` [PATCH 4/4] btrfs: test invalid splitting when skipping pinned drop extent_map Josef Bacik
2023-08-18 10:49 ` Filipe Manana
2023-08-17 23:52 ` [PATCH 0/4] Fix incorrect splitting logic in btrfs_drop_extent_map_range David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1692305624.git.josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox