Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Li Chen <me@linux.beauty>
To: "sashiko" <sashiko@lists.linux.dev>
Cc: "tytso" <tytso@mit.edu>, "Linux ext4" <linux-ext4@vger.kernel.org>
Subject: Re: [RFC v7 3/7] ext4: fast commit: avoid waiting for FC_COMMITTING
Date: Tue, 12 May 2026 20:22:56 +0800	[thread overview]
Message-ID: <19e1c23ebca.6a3c475d372729.498530157652304808@linux.beauty> (raw)
In-Reply-To: <20260512022525.BD660C2BCF5@smtp.kernel.org>

Hi sashiko,

 ---- On Tue, 12 May 2026 10:25:25 +0800   <sashiko-bot@kernel.org> wrote --- 
 > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
 > - [High] Wait loops using `bit_waitqueue` test the wrong bit on 64-bit platforms, causing permanent deadlocks due to ignored wakeups for files with certain on-disk flags (e.g., encrypted or uncompressed files).
 > --
 > 
 > Note: The standard inline-diff format for this LKML report has been altered
 > to a free-form summary due to automated system recitation restrictions.
 > 
 > commit 6a0b3a4122c0edab1e98d39dcec0cf8e11e66265
 > Author: Li Chen <chenl311@chinatelecom.cn>
 > ext4: fast commit: avoid waiting for FC_COMMITTING
 > 
 > This commit removes the block on FC_COMMITTING during fast commit inode
 > tracking to avoid deadlocks. It instead requeues modified inodes via a new
 > state flag and adds wait loops in the eviction path to block while a commit
 > is actively using the inode.
 > 
 > Looking at the newly added wait loop in ext4_fc_del() and the wakeup in
 > ext4_fc_cleanup(), could the use of bit_waitqueue() and DEFINE_WAIT_BIT()
 > with EXT4_STATE_FC_COMMITTING and EXT4_STATE_FC_FLUSHING_DATA cause tasks
 > to sleep forever on 64-bit systems?
 > 
 > On 64-bit platforms, the EXT4_INODE_BIT_FNS macro maps dynamic state flags
 > to bits 32 and above in the i_flags field. For example, the enum values for
 > EXT4_STATE_FC_COMMITTING (10) and EXT4_STATE_FC_FLUSHING_DATA (11) are
 > actually evaluated as bits 42 and 43 when accessed through the proper
 > ext4_test_inode_state() helpers.
 > 
 > However, the 64-bit fallback paths for the wait queues and wake_up_bit()
 > calls in this patch act directly on i_flags using the unshifted enum
 > values 10 and 11. In the context of the raw i_flags field, bit 10
 > corresponds to EXT4_NOCOMPR_FL, and bit 11 corresponds to EXT4_ENCRYPT_FL.
 > 
 > If a file has the encrypted or no-compress on-disk flags set, test_bit() in
 > the kernel's wake_bit_function() will return true because the on-disk flags
 > are set, rather than checking the intended dynamic state flags. Will this
 > cause wake_bit_function() to assume the condition is still pending and
 > ignore the wakeup, leaving the task in ext4_fc_del() deadlocked in an
 > uninterruptible sleep?
 > 
 > -- 
 > Sashiko AI review · https://sashiko.dev/#/patchset/20260511084304.1559557-1-me@linux.beauty?part=3
 > 

Thanks, good catch. This bug was already in 857d32f26181 ("ext4: rework
fast commit commit path"); this patch just moved the same wait/wake code
into ext4_fc_del().

I think it's cleaner to send a small standalone fix patch first, instead
of folding this into v8. I'll add a helper to map EXT4_STATE_* to the
real wait word/bit, and use it for both bit_waitqueue() and wake_up_bit()
so it matches ext4_test_inode_state() on 64-bit.

I'll look at the other two review mails tomorrow.

Li​


  parent reply	other threads:[~2026-05-12 12:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  8:42 [RFC v7 0/7] ext4: fast commit: snapshot inode state for FC log Li Chen
2026-05-11  8:42 ` [RFC v7 1/7] ext4: fast commit: snapshot inode state before writing log Li Chen
2026-05-11  8:42 ` [RFC v7 2/7] ext4: lockdep: handle i_data_sem subclassing for special inodes Li Chen
2026-05-11  8:42 ` [RFC v7 3/7] ext4: fast commit: avoid waiting for FC_COMMITTING Li Chen
     [not found]   ` <20260512022525.BD660C2BCF5@smtp.kernel.org>
2026-05-12 12:22     ` Li Chen [this message]
2026-05-11  8:42 ` [RFC v7 4/7] ext4: fast commit: avoid self-deadlock in inode snapshotting Li Chen
2026-05-11  8:43 ` [RFC v7 5/7] ext4: fast commit: avoid i_data_sem by dropping ext4_map_blocks() in snapshots Li Chen
2026-05-11  8:43 ` [RFC v7 6/7] ext4: fast commit: add lock_updates tracepoint Li Chen
2026-05-11  8:43 ` [RFC v7 7/7] ext4: fast commit: export snapshot stats in fc_info 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=19e1c23ebca.6a3c475d372729.498530157652304808@linux.beauty \
    --to=me@linux.beauty \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sashiko@lists.linux.dev \
    --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