From: Jeff Layton <jlayton@kernel.org>
To: Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH 0/4] btrfs: handle -ENOMEM errors in some synchronous dirops without aborting
Date: Fri, 17 Jul 2026 12:52:35 -0400 [thread overview]
Message-ID: <20260717-btrfs-enomem-v1-0-cdc9c0e265d0@kernel.org> (raw)
We've had a (relatively small) number of ENOMEM btrfs aborts occur in
synchronous directory morphing codepaths. It's not terribly common, but
there are a few places where an memory allocation failure results in an
abort.
This patchset reworks the code to do the allocations up front, before the
point where we'd have to abort the fs if it fails.
This does not cover all potential cases where this can currently occur.
In particular, a rename that overwrites the target can still abort the
fs if a memory allocation fails. Fixing that is, unfortunately
substantially more work, but this should help improve things.
AFAICT, these are ancient problems, dating back at least to ~2011, so I
didn't bother adding Fixes: tags.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Jeff Layton (4):
btrfs: split btrfs_insert_delayed_dir_index() into prealloc and commit phases
btrfs: pre-allocate delayed dir index before btree modification
btrfs: handle ENOMEM from btrfs_insert_dir_item() without aborting
btrfs: pre-allocate delayed dir index for non-overwrite rename
fs/btrfs/btrfs_inode.h | 4 +-
fs/btrfs/delayed-inode.c | 109 ++++++++++++++++++++++++++++++++++++-----------
fs/btrfs/delayed-inode.h | 17 ++++++++
fs/btrfs/dir-item.c | 30 ++++++++++---
fs/btrfs/dir-item.h | 5 ++-
fs/btrfs/inode.c | 60 +++++++++++++++++++++-----
fs/btrfs/transaction.c | 2 +-
fs/btrfs/tree-log.c | 4 +-
8 files changed, 185 insertions(+), 46 deletions(-)
---
base-commit: af5e34a41cd607c00ef752e00331736570992354
change-id: 20260715-btrfs-enomem-988f2cc36ffd
Best regards,
--
Jeff Layton <jlayton@kernel.org>
next reply other threads:[~2026-07-17 16:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 16:52 Jeff Layton [this message]
2026-07-17 16:52 ` [PATCH 1/4] btrfs: split btrfs_insert_delayed_dir_index() into prealloc and commit phases Jeff Layton
2026-07-17 16:52 ` [PATCH 2/4] btrfs: pre-allocate delayed dir index before btree modification Jeff Layton
2026-07-17 16:52 ` [PATCH 3/4] btrfs: handle ENOMEM from btrfs_insert_dir_item() without aborting Jeff Layton
2026-07-17 20:18 ` Boris Burkov
2026-07-17 22:40 ` Jeff Layton
2026-07-17 23:04 ` Boris Burkov
2026-07-17 23:55 ` Jeff Layton
2026-07-18 0:13 ` Boris Burkov
2026-07-18 0:19 ` Qu Wenruo
2026-07-17 16:52 ` [PATCH 4/4] btrfs: pre-allocate delayed dir index for non-overwrite rename Jeff Layton
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=20260717-btrfs-enomem-v1-0-cdc9c0e265d0@kernel.org \
--to=jlayton@kernel.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@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