From: "Xing Ma" <maxing.lan@bytedance.com>
To: <linux-ext4@vger.kernel.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
"Andreas Dilger" <adilger.kernel@dilger.ca>,
"Jan Kara" <jack@suse.cz>,
"Baokun Li" <libaokun@linux.alibaba.com>,
"Ojaswin Mujoo" <ojaswin@linux.ibm.com>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
"Zhang Yi" <yi.zhang@huawei.com>,
"Harshad Shirwadkar" <harshadshirwadkar@gmail.com>
Subject: [PATCH v2 0/2] ext4: fix fast commit orphan inode replay and truncate range tracking
Date: Tue, 01 Dec 2026 01:37:42 +0800 [thread overview]
Message-ID: <20261201013742.1563067-1-maxing.lan@bytedance.com> (raw)
This 2-patch series fixes two crash-recovery bugs in ext4 fast commit
on tytso/ext4.git dev (aceadbccd428f):
1. Patch 1 ("ext4: fall back to full commit for unlinked or orphan
inodes in fast commit"):
Fast commit does not log orphan list updates. Snapshotting an
unlinked open inode (i_nlink == 0) emits EXT4_FC_TAG_INODE with
i_links_count == 0, which causes ext4_fc_replay_inode() to fail
ext4_iget() with -ESTALE -> -EFSCORRUPTED and abort journal recovery.
Snapshotting a mid-truncate orphan inode logs shrunk i_size with
unfreed extents. Fall back cleanly to a full JBD2 commit via
-ECANCELED, and add KUnit coverage in fast_commit-test.c.
2. Patch 2 ("ext4: track truncated block range in ext4_truncate() for
fast commit"):
ext4_fc_track_range() for truncation is only called in
ext4_truncate_down(), missing same-size ftruncate(fd, oldsize)
dropping FALLOC_FL_KEEP_SIZE post-EOF blocks, cross-transaction
ext4_truncate() handles, and handle restarts in
ext4_ext_remove_space() / ext4_ind_truncate(). Track
[start_lblk, EXT_MAX_BLOCKS - 1] directly in ext4_truncate().
Changes since v1 (addressing Sashiko AI review):
- Patch 1: unchanged (no issues found).
- Patch 2:
* Move ext4_fc_track_range() after the `if (err) goto out_stop;`
check and guard it with `!ext4_handle_is_aborted(handle)` to avoid
dereferencing a NULL handle->h_transaction after a failed journal
restart.
* Call ext4_fc_track_range() unconditionally (not only for
EXT4_INODE_EXTENTS), matching ext4_truncate_down() so indirect-
mapped inodes also properly trigger full-commit fallback.
Testing on tytso/ext4.git dev (aceadbccd428f, -O fast_commit):
- Patch 1: xfstests generic/764 fails 100% before ("Structure needs
cleaning" / "JBD2: journal recovery failed") and passes after;
KUnit ext4_fast_commit_test 11/11 PASS.
- Patch 2: 4-step xfs_io + dm-flakey reproducer (falloc -k 4k 64k,
sync, truncate 4k + fsync, crash/remount) resurrects 64K post-EOF
blocks before (stat -c %b = 136 vs 8) and stays 8 after.
Xing Ma (2):
ext4: fall back to full commit for unlinked or orphan inodes in fast
commit
ext4: track truncated block range in ext4_truncate() for fast commit
fs/ext4/fast_commit-test.c | 18 ++++++++++++++++++
fs/ext4/fast_commit.c | 17 +++++++++++++++++
fs/ext4/inode.c | 9 +++++++++
3 files changed, 44 insertions(+)
base-commit: aceadbccd428fb8e6593b27a3091d961f80225d1
--
2.39.5
next reply other threads:[~2026-11-30 17:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 17:37 Xing Ma [this message]
2026-11-30 17:37 ` [PATCH v2 1/2] ext4: fall back to full commit for unlinked or orphan inodes in fast commit Xing Ma
2026-11-30 17:37 ` [PATCH v2 2/2] ext4: track truncated block range in ext4_truncate() for " Xing Ma
2026-11-30 17:54 ` sashiko-bot
2026-11-30 17:54 ` [PATCH v2 0/2] ext4: fix fast commit orphan inode replay and truncate range tracking sashiko-bot
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=20261201013742.1563067-1-maxing.lan@bytedance.com \
--to=maxing.lan@bytedance.com \
--cc=adilger.kernel@dilger.ca \
--cc=harshadshirwadkar@gmail.com \
--cc=jack@suse.cz \
--cc=libaokun@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
/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