Linux EXT4 FS development
 help / color / mirror / Atom feed
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" <ritesh.list@gmail.com>,
	 "Zhang Yi" <yi.zhang@huawei.com>,
	 "Harshad Shirwadkar" <harshadshirwadkar@gmail.com>,
	 "Xin Yin" <yinxin.x@bytedance.com>,
	"Xing Ma" <maxing.lan@bytedance.com>
Subject: [PATCH 0/3] ext4: fix concurrent fast commit durability and tracking races
Date: Tue,  1 Dec 2026 00:38:16 +0800	[thread overview]
Message-ID: <20261130163819.13819-1-maxing.lan@bytedance.com> (raw)

Under concurrent writers and fsync() workloads (reproducible with
xfstests generic/455 and MKFS_OPTIONS="-O fast_commit"), ext4 fast
commit has three concurrency races that lose fsync()'d updates or leave
extents inconsistent after crash recovery:

1. ext4_fc_commit() skips committing when an already-ongoing fast
   commit increments s_fc_subtid, even though the waiting caller's
   updates were queued on FC_Q_STAGING or marked EXT4_STATE_FC_REQUEUE
   and were not included in that commit.

2. __jbd2_fc_end_commit() and jbd2_journal_commit_transaction() invoke
   ext4_fc_cleanup() before clearing JBD2_FAST_COMMIT_ONGOING /
   JBD2_FULL_COMMIT_ONGOING, letting concurrent updates land on
   FC_Q_STAGING after cleanup drains it and remain stranded during the
   next fast commit.

3. ext4_fc_track_{inode,range,create,link,unlink}() skip tracking
   whenever EXT4_MF_FC_INELIGIBLE is set without comparing
   handle->h_transaction->t_tid against s_fc_ineligible_tid, dropping
   tracking for transaction T + 1 while transaction T finishes its full
   commit; ext4_fc_cleanup() also cleared EXT4_MF_FC_INELIGIBLE when
   full == 0.

Testing on tytso/ext4.git dev (aceadbccd428f):
- xfstests generic/455 (-O fast_commit): 7/26 FAIL (~27%) before;
  48/48 PASS after (96/96 PASS combined with the companion orphan and
  truncate fast commit fixes).
- KUnit ext4_fast_commit_test: 11/11 PASS, 0 lockdep warnings.

Xing Ma (3):
  ext4: do not skip fast commit for updates queued during ongoing commit
  ext4: splice stranded fast commit staging queues before starting
    commit
  ext4: keep tracking newer transactions while older tid is
    fc-ineligible

 fs/ext4/fast_commit.c | 74 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 61 insertions(+), 13 deletions(-)

base-commit: aceadbccd428fb8e6593b27a3091d961f80225d1
-- 
2.39.5

             reply	other threads:[~2026-11-30 16:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 16:38 Xing Ma [this message]
2026-11-30 16:38 ` [PATCH 1/3] ext4: do not skip fast commit for updates queued during ongoing commit Xing Ma
2026-11-30 16:57   ` sashiko-bot
2026-11-30 16:38 ` [PATCH 2/3] ext4: splice stranded fast commit staging queues before starting commit Xing Ma
2026-11-30 16:54   ` sashiko-bot
2026-11-30 16:38 ` [PATCH 3/3] ext4: keep tracking newer transactions while older tid is fc-ineligible Xing Ma
2026-11-30 16:58   ` 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=20261130163819.13819-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 \
    --cc=yinxin.x@bytedance.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