mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Theodore Tso" <tytso@mit.edu>
To: Christian Brauner <brauner@kernel.org>
Cc: Luyao Bai <bailuyao1997@gmail.com>,
	linux-ext4@vger.kernel.org,
	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>,
	"Darrick J . Wong" <djwong@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext4: do not WARN when starting a journal on a frozen filesystem
Date: Fri, 24 Jul 2026 09:31:19 -0400	[thread overview]
Message-ID: <amNnKl4V7DPrBHX_@mit.edu> (raw)
In-Reply-To: <20260724-gaben-sachverhalt-medizin-312848359765@brauner>

On Fri, Jul 24, 2026 at 10:11:01AM -0500, Christian Brauner wrote:
> I can't say whether this is the right fix but it feels hacky and racy
> unless this code holds s_umount - which it may well do.

Oh, it's worse than that.  From the Sashiko review[1]:

> [Severity: High]
> Does returning -EROFS here cause fsync() to spuriously fail? If userspace
> calls fsync() on a file with dirty pages while the filesystem is in
> SB_FREEZE_COMPLETE, since fsync() bypasses VFS freeze locks, it seems it
> would hit this new path and fail with -EROFS instead of safely blocking
> until the freeze is lifted.

And it's not just fsync().  Any caller of ext4_journal_start() will
end falling into this codepath, which means most ext4 operations
happening during a freeze could very well fail with an EROFS error.

> Also, is there a TOCTOU race with SB_FREEZE_FS here? If a background
> writeback thread evaluates this lockless check while VFS is in the
> SB_FREEZE_FS phase, it will evaluate to false and proceed to
> jbd2__journal_start() where it blocks on the journal barrier. When
> ext4_freeze() finishes, it drops the barrier and VFS sets
> SB_FREEZE_COMPLETE. The blocked thread then wakes up and starts a
> transaction on the now-frozen filesystem.

Luyao, I'm curious what (if any) testing you performed before
submitting this patch?  And I'm curious if some AI / LLM was used in
the preparation of this patch?

Thanks,

						- Ted

[1] https://sashiko.dev/#/patchset/20260723205036.661832-1-bailuyao1997@gmail.com?part=1

  reply	other threads:[~2026-07-24 13:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 20:50 Luyao Bai
2026-07-24  8:11 ` Christian Brauner
2026-07-24 13:31   ` Theodore Tso [this message]
2026-07-24 14:16     ` Luyao Bai
2026-07-24 14:32       ` Theodore Tso
2026-07-28 13:45 ` Jan Kara

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=amNnKl4V7DPrBHX_@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=bailuyao1997@gmail.com \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=jack@suse.cz \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --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

all inboxes | Powered by JetHome®