linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] btrfs: ref_tracker for delayed_nodes
@ 2025-08-07 23:53 Leo Martins
  2025-08-07 23:53 ` [PATCH v3 1/3] btrfs: implement " Leo Martins
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Leo Martins @ 2025-08-07 23:53 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

The leading btrfs related crash in our fleet is a soft lockup in
btrfs_kill_all_delayed_nodes caused by a btrfs_delayed_node leak.
This patchset introduces ref_tracker infrastructure to detect this
leak. I'm mirroring the way REF_VERIFY is setup with a Kconfig and
a mount option. I've run a full fstests suite with ref_tracker enabled
and experienced roughly a 7% slowdown in runtime.

Changelog:
v1: https://lore.kernel.org/linux-btrfs/fa19acf9dc38e93546183fc083c365cdb237e89b.1752098515.git.loemra.dev@gmail.com/
v2: https://lore.kernel.org/linux-btrfs/20250805194817.3509450-1-loemra.dev@gmail.com/T/#mba44556cfc1ae54c84255667a52a65f9520582b7

v2->v3:
- wrap ref_tracker and ref_tracker_dir in btrfs helper structs
- fix long function formatting
- new Kconfig CONFIG_BTRFS_FS_REF_TRACKER + ref_tracker mount option
- add a print to expose potential leaks
- move debug fields to the end of the struct

v1->v2:
- remove typedefs, now functions always take struct ref_tracker **
- put delayed_node::count back to original position to not change
  delayed_node struct size
- cleanup ref_tracker_dir if btrfs_get_or_create_delayed_node
  fails to create a delayed_node
- remove CONFIG_BTRFS_DELAYED_NODE_REF_TRACKER and use
  CONFIG_BTRFS_DEBUG

Leo Martins (3):
  btrfs: implement ref_tracker for delayed_nodes
  btrfs: print leaked references in kill_all_delayed_nodes
  btrfs: add mount option for ref_tracker

 fs/btrfs/Kconfig         |  12 +++
 fs/btrfs/delayed-inode.c | 193 ++++++++++++++++++++++++++++-----------
 fs/btrfs/delayed-inode.h |  93 +++++++++++++++++++
 fs/btrfs/fs.h            |   1 +
 fs/btrfs/super.c         |  13 +++
 5 files changed, 257 insertions(+), 55 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-12 11:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 23:53 [PATCH v3 0/3] btrfs: ref_tracker for delayed_nodes Leo Martins
2025-08-07 23:53 ` [PATCH v3 1/3] btrfs: implement " Leo Martins
2025-08-07 23:53 ` [PATCH v3 2/3] btrfs: print leaked references in kill_all_delayed_nodes Leo Martins
2025-08-07 23:53 ` [PATCH v3 3/3] btrfs: add mount option for ref_tracker Leo Martins
2025-08-08 11:09 ` [PATCH v3 0/3] btrfs: ref_tracker for delayed_nodes David Sterba
2025-08-12 11:35 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).