Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: "Petr Vaněk" <petr.vanek@e2b.dev>
To: Jan Kara <jack@suse.cz>
Cc: "Petr Vaněk" <petr.vanek@e2b.dev>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"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>,
	"Deepanshu Kartikey" <kartikey406@gmail.com>,
	stable@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/3] ext4: convert regular file inline data through the page cache
Date: Sat,  5 Dec 2026 11:21:40 +0100	[thread overview]
Message-ID: <20261205102140.28450-1-petr.vanek@e2b.dev> (raw)
In-Reply-To: <awfevpp6kch4sczxhpublixkaf75sfarvzso4t6rzv4xgyly2n@m56pcc6zn7zo>

On Fri, Nov 27, 2026 at 04:07:03PM +0100, Jan Kara wrote:
> Nasty, thanks for analyzing this. How did you find the problem? I.e., is it
> some syscall fuzzing, AI analysis, or real users hitting this?

Real users were hitting this.

> I have two comments regarding the solution:
>
> 1) We converted data using journalled data write to avoid loss of already
> written data in case of crash before newly allocated block gets written
> out. I personally never liked this much and agree this is asking for big
> trouble (as your report shows) so I'm all for getting rid of this case. But
> still we should explain the implications in the changelog - if we actually
> don't use delayed allocation (which is what you did) and use data=ordered
> mode, the data loss after a crash should not happen so I think we are fine.

Agreed, I'll explain it in the next version.

> 2) Why did you implement new conversion function and didn't just use
> ext4_convert_inline_data_to_extent()? I don't really want *another* inline
> data conversion method so if there's some reason why
> ext4_convert_inline_data_to_extent() cannot be used, let's discuss how to
> make possible to use it...

The problem was its error path.  If mapping block 0 fails, it truncates
the file with ext4_truncate_failed_write(), which takes invalidate_lock
while page_mkwrite already holds it.  Changing that would have touched
the buffered-write path, so I wrote a separate function that restores
the inline data instead, as ext4_convert_inline_data_nolock() does.

Sashiko has since found [1] that truncating also loses data in the write
path: the inline data has already been dropped, leaving the bytes only
in the clean folio 0.  So the helper needs that change anyway: keep a
kmalloc'ed copy of the inline data before dropping it, and restore it
with ext4_restore_inline_data() if mapping fails.  The restore path has
a stale checksum problem, which my earlier patch fixes [2].

With that change, regular files can use the helper too, with no need
for a new conversion function.

[1] https://lore.kernel.org/linux-ext4/sashiko-outbox-240817@kernel.org/
[2] https://lore.kernel.org/20261125143841.928615-1-petr.vanek@e2b.dev

      reply	other threads:[~2026-12-05 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261126201258.1553196-1-petr.vanek@e2b.dev>
2026-11-26 20:12 ` [PATCH 2/3] ext4: convert regular file inline data through the page cache Petr Vaněk
2026-11-27 15:07   ` Jan Kara
2026-12-05 10:21     ` Petr Vaněk [this message]

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=20261205102140.28450-1-petr.vanek@e2b.dev \
    --to=petr.vanek@e2b.dev \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=kartikey406@gmail.com \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=stable@vger.kernel.org \
    --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