From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796032391; b=GDd+PUke5NbTQGKu67nMb8MF7gdtQPwrW/YtGolKn6IoQtWHB4XrCOTi2YRJREFYtvoH 6j7/9x4uxp3axgrW48SGG22KRc1V60exXPRFAoSuHi6hya+Iw2rIwzFquYHb/8jqCVQHm z4ErzbzmpK3Pip2jXnZ1U1/4r5AH/IDsx6O5IJVwacE/7IT46DQh67NDb7OuLKffDPx7P ENsPqdzqJaDBfr9E7OaLWpT4KajVQMsjYJmn0X1woVg2w7G7xEL2vRn5IfhrxELNyCM8S ibK82uBv6QqV0IYS8HP4YrBrfXzGFwh6FHE3Bo4Rrx0K7OyuZK41EkAnB54wSHOZYxQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796032391; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=oLMHNtRiOadgH2psOZ84rSL+IbGhKLZHnUiAjPUuekA=; b=33iRy8MjKB6eb2M1bLNNCtIarURVg9oCy+VnVup9LD7rRWHK2RPCuRnBvfwTw1i4WMsf CSnCE8qWdvlx/152riCd/o8aCKsqSmJbGlYfEUwppsQL5oxQDMAYyKG2IUFmtia8S4sy8 VKloZGMEiV/ncmW4LxG9QMJk08ev125aWbPpvJxV7HVhj0WQBxysBU9kFfQpVESFxEpso NWPQz1XU1b57YB+SFo8VJ6cqc7oqzGUJyLygRM2qQGhP1/IGx6FTD9ldlndSZzmOSj7Nq a1vpTcNrFkex/HU/IRstCenkeRmOMA9Dmcm/rlY8RhKG1zW14lr1gT43vMvZZEEh/8A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Rzd2oCG7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F3D3606A325 for ; Mon, 30 Nov 2026 09:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Rzd2oCG7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63CEA1F000C1; Mon, 30 Nov 2026 09:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796032390; bh=oLMHNtRiOadgH2psOZ84rSL+IbGhKLZHnUiAjPUuekA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Rzd2oCG7s7MFxH03U70ObMutbmVl63aoFxZrXHV0Ti6yKajtQg7DAFMIZbTEFIPtP HFNvzbEb6uNwPl8UBqGU40X6TvFwKJIwzX7oUDlG4uv7OqhADVd6Ryk3t0sP7rDVqz UmHFVLawL4ItRJvMH8+pKIAQES8ny4qhznfvVmi+5CFuUi7fIfQ+APXmKKOgNM65Vs vPVVrAwRsuux0u+QQ8ofgYv8X8kRvsm4ZU4bagztmO7i9C8P+MblCw6QZ3QOI0ae6e mR+MnW8hIa+g1RksSLXZH3ZZQlatsuCoepOBLadgqqjP5cqgqCOv+dFbDQdUksof2v dFrk5zSvWHaeQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] ext4: retry inline data conversion on -EAGAIN Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?UGV0ciBWYW7Em2s=?= Cc: linux-ext4@vger.kernel.org, tytso@mit.edu In-Reply-To: <20261130094048.1869586-1-petr.vanek@e2b.dev> References: <20261130094048.1869586-1-petr.vanek@e2b.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 09:53:09 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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=C4=9Bk > 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 > Link: https://lore.kernel.org/linux-ext4/sashiko-outbox-236164@kernel.org/ > Fixes: e2c4c49dee64 ("ext4: restart handle if credits are insufficient du= ring 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); > } > =20 > - if (ret =3D=3D -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries= )) > + if (ret =3D=3D -EAGAIN || > + (ret =3D=3D -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retrie= s))) > goto retry; > =20 > 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 =3D 0; goto out; } from =3D 0; to =3D 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 =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130094048.1869= 586-1-petr.vanek@e2b.dev?part=3D1