From: sashiko-bot@kernel.org
To: "Petr Vaněk" <petr.vanek@e2b.dev>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] ext4: retry inline data conversion on -EAGAIN
Date: Mon, 30 Nov 2026 09:53:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-240817@kernel.org> (raw)
In-Reply-To: <20261130094048.1869586-1-petr.vanek@e2b.dev>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Critical] ext4: data loss on -EAGAIN retry in
ext4_convert_inline_data_to_extent()
- [High] ext4: missing Signed-off-by trailer in commit message
--
commit 5b9d895c8cda9a4767a10cb3e7eca662442af68d
Author: Petr Vaněk <petr.vanek@e2b.dev>
> ext4: retry inline data conversion on -EAGAIN
>
> Commit e2c4c49dee64 ("ext4: restart handle if credits are insufficient
> during allocating blocks") made ext4_block_write_begin() return -EAGAIN
> when it cannot extend the handle, and taught its callers in inode.c to
> retry. ext4_convert_inline_data_to_extent() was missed and passes the
> error to write(2). It always needs the extension, because its handle is
> sized before the inode has an extent tree, so with nodelalloc a write
> that converts inline data fails with EAGAIN when a commit starts.
>
> Retry on -EAGAIN like the other callers.
>
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Link: https://lore.kernel.org/linux-ext4/sashiko-outbox-236164@kernel.org/
> Fixes: e2c4c49dee64 ("ext4: restart handle if credits are insufficient during allocating blocks")
> Cc: stable@vger.kernel.org
[Severity: High]
The commit message is missing a Signed-off-by: trailer from the author.
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index acdc65ce47960..274cc96daec7b 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -682,7 +682,8 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,
> ext4_orphan_del(NULL, inode);
> }
>
> - if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
> + if (ret == -EAGAIN ||
> + (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)))
> goto retry;
>
> if (folio)
[Severity: Critical]
Does jumping back to retry on -EAGAIN silently drop the original inline
data and leave logical block 0 unallocated?
Before ext4_block_write_begin() runs and returns -EAGAIN, the first pass
has already read the inline data into folio 0 (leaving it uptodate, clean,
and unmapped) and called ext4_destroy_inline_data_nolock(), which deletes
the on-disk inline data, clears EXT4_INODE_INLINE_DATA, and zeroes
i_inline_off and i_inline_size. The error path then unlocks and releases
folio 0 and stops the journal handle, committing the removal of the inline
data.
On the retry pass, ext4_convert_inline_data_to_extent() re-checks whether
the inode still has inline data:
fs/ext4/inline.c:ext4_convert_inline_data_to_extent() {
...
/* If some one has already done this for us, just exit. */
if (!ext4_has_inline_data(inode)) {
ret = 0;
goto out;
}
from = 0;
to = ext4_get_inline_size(inode);
...
}
Because the first attempt already cleared the inline state,
ext4_has_inline_data(inode) is now false (and ext4_get_inline_size(inode)
is 0), so the retry immediately exits with ret = 0 without calling
ext4_block_write_begin() or block_commit_write(). If the write that
triggered conversion starts at or past logical block 1 (or if clean,
unlocked folio 0 is reclaimed before ext4_write_begin() re-locks it),
logical block 0 is never allocated or dirtied and the original inline data
is permanently lost, reading back as a hole of zeros once folio 0 is
evicted.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130094048.1869586-1-petr.vanek@e2b.dev?part=1
prev parent reply other threads:[~2026-11-30 9:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 9:40 [PATCH] ext4: retry inline data conversion on -EAGAIN Petr Vaněk
2026-11-30 9:49 ` Petr Vaněk
2026-11-30 9:53 ` sashiko-bot [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=sashiko-outbox-240817@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=petr.vanek@e2b.dev \
--cc=sashiko-reviews@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