From: Li Chen <me@linux.beauty>
To: "Theodore Ts'o" <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH v2 0/2] ext4: fast commit: fix lockdep issues
Date: Mon, 22 Dec 2025 23:19:04 +0800 [thread overview]
Message-ID: <20251222151906.24607-1-me@linux.beauty> (raw)
Hi,
This series fixes two lockdep issues in the ext4 fast commit paths.
1) ext4_fc_track_inode() can return without sleeping when
EXT4_STATE_FC_COMMITTING is already clear. The lockdep assertion for
i_data_sem should only fire when we actually go to sleep.
2) lockdep reports a possible deadlock due to lock order inversion
between s_fc_lock and i_data_sem. The fast commit writer held s_fc_lock
while writing the fast commit log. Writing the journal inode mapping
can call ext4_map_blocks() and take i_data_sem, while metadata update
paths can hold i_data_sem and call ext4_fc_track_inode() which takes
s_fc_lock.
The fix drops s_fc_lock before the log writing step and uses
EXT4_STATE_FC_COMMITTING to keep inode and create dentry state stable
until cleanup.
Testing:
- QEMU VM, ext4 -O fast_commit on virtio-pmem + dax, verified both lockdep
report reproduces on an older kernel and is gone with this series.
RFC v1 -> RFC v2:
- patch 1: move comments to correct place
- patch 2: add it to patchset.
- add missing RFC prefix
RFC v1: https://lore.kernel.org/linux-ext4/20251222032655.87056-1-me@linux.beauty/T/#u
Li Chen (2):
ext4: fast_commit: assert i_data_sem only before sleep
ext4: fast commit: fix s_fc_lock vs i_data_sem inversion
fs/ext4/fast_commit.c | 96 +++++++++++++++++++++++++++++++------------
1 file changed, 69 insertions(+), 27 deletions(-)
--
2.51.0
next reply other threads:[~2025-12-22 15:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-22 15:19 Li Chen [this message]
2025-12-22 15:19 ` [RFC PATCH v2 1/2] ext4: fast_commit: assert i_data_sem only before sleep Li Chen
2025-12-22 15:19 ` [RFC PATCH v2 2/2] ext4: fast commit: fix s_fc_lock vs i_data_sem inversion Li Chen
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=20251222151906.24607-1-me@linux.beauty \
--to=me@linux.beauty \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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