Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #82744

Bug#1039883: linux: ext4 corruption with symlinks

Path csiph.com!fu-berlin.de!bofh.it!news.nic.it!robomod
From Luis Henriques <luis.henriques@linux.dev>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#1039883: linux: ext4 corruption with symlinks
Date Tue, 18 Jun 2024 12:10:02 +0200
Message-ID <IQDWO-3ML8-3@gated-at.bofh.it> (permalink)
References <GLVm1-1I2F-11@gated-at.bofh.it> <GV038-2oYj-11@gated-at.bofh.it> <HvHNT-2Ch4-3@gated-at.bofh.it> <IJNod-gTKg-5@gated-at.bofh.it> <IPhYl-2V7L-5@gated-at.bofh.it> <IPhYl-2V7L-3@gated-at.bofh.it> <GLVm1-1I2F-11@gated-at.bofh.it> <IPhYl-2V7L-3@gated-at.bofh.it>
X-Original-To Luis Henriques <luis.henriques@linux.dev>
X-Mailbox-Line From debian-bugs-dist-request@lists.debian.org Tue Jun 18 10:03:11 2024
Old-Return-Path <debbugs@buxtehude.debian.org>
X-Spam-Flag NO
X-Spam-Score 0.439
Reply-To Luis Henriques <luis.henriques@linux.dev>, 1039883@bugs.debian.org
Resent-To debian-bugs-dist@lists.debian.org
Resent-Cc Debian Kernel Team <debian-kernel@lists.debian.org>
X-Debian-Pr-Message followup 1039883
X-Debian-Pr-Package src:linux
X-Debian-Pr-Keywords upstream
X-Debian-Pr-Source linux
Old-X-Envelope-To luis.henriques@linux.dev
Old-X-Envelope-To ben@decadent.org.uk
Old-X-Envelope-To linux-ext4@vger.kernel.org
Old-X-Envelope-To dud225@hotmail.com
Old-X-Envelope-To didi.debian@cknow.org
Old-X-Envelope-To 1039883@bugs.debian.org
Old-X-Envelope-To carnil@debian.org
Old-X-Envelope-To harshadshirwadkar@gmail.com
X-Report-Abuse Please report any abuse attempt to abuse@migadu.com and include these headers.
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding quoted-printable
X-Migadu-Flow FLOW_OUT
X-Greylist delayed 323 seconds by postgrey-1.36 at buxtehude; Tue, 18 Jun 2024 09:58:33 UTC
X-Debian-Message from BTS
X-Mailing-List <debian-bugs-dist@lists.debian.org> archive/latest/1843028
List-ID <debian-bugs-dist.lists.debian.org>
List-URL <https://lists.debian.org/debian-bugs-dist/>
Approved robomod@news.nic.it
Lines 59
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Cc Ben Hutchings <ben@decadent.org.uk>, linux-ext4@vger.kernel.org, Hervé Werner <dud225@hotmail.com>, Diederik de Haas <didi.debian@cknow.org>, 1039883@bugs.debian.org, Salvatore Bonaccorso <carnil@debian.org>, harshad shirwadkar <harshadshirwadkar@gmail.com>
X-Original-Date Tue, 18 Jun 2024 10:52:55 +0100
X-Original-Message-ID <87tthq37d4.fsf@brahms.olymp>
X-Original-References <168802788716.2369531.1979971093539266086.reportbug@ariane.home> <ZL5DB7vU3GnIx588@eldamar.lan> <2002858.macj2W6JUv@bagend> <DB4PR02MB936085F4449207358A9943568FABA@DB4PR02MB9360.eurprd02.prod.outlook.com> <e6797603353b8162df6c29777ed5936af4d11b32.camel@decadent.org.uk> <87plsj4hwa.fsf@brahms.olymp> <168802788716.2369531.1979971093539266086.reportbug@ariane.home> <87plsj4hwa.fsf@brahms.olymp>
Xref csiph.com linux.debian.bugs.dist:1201409 linux.debian.kernel:82744

Cross-posted to 2 groups.

Show key headers only | View raw


On Fri 14 Jun 2024 05:18:45 PM +01, Luis Henriques wrote;
[...}
>>
>> I can also reproduce this error message using the above script and:
>>
>> - Linux 6.10-rc2
>> - A 2 GiB loopback devic instead of /dev/sdb
>>
>> I bisected this back to:
>>
>> commit 9725958bb75cdfa10f2ec11526fdb23e7485e8e4
>> Author: Xin Yin <yinxin.x@bytedance.com>
>> Date:   Thu Dec 23 11:23:37 2021 +0800
>>  
>>     ext4: fast commit may miss tracking unwritten range during ftruncate
>>
>> It is still possible to cleanly revert that commit from 6.10-rc2, and
>> doing so removes the error message.
>
> Because I recently fixed an issue in the fast commit code[1] I was hoping
> that you were hitting the same bug.  I've executed the reproducer with the
> fix (which hasn't been merged yet) and realised it's definitely a
> different problem.
>
> Debugged the issue a bit, it seems to be related with the fact that
> ext4_fc_write_inode_data() isn't able to cope with the fact that
> 'ei->i_fc_lblk_len' is set to EXT_MAX_BLOCKS.

OK, I've looked into this again.  And something I didn't pay attention
before was that the filesystem was created with both fast_commit *and*
inline_data features.  And after some more debugging, I _think_ the patch
bellow should be the fix for this bug.

If I understand it correctly, when an inode has inlined data it means that
there's no inode data to be written and this case should be handled as if
the inode length was zero.

I'll send out a patch later after running a few more tests just to make
sure it doesn't break something else.  But it would awesome if you could
test it too.

Cheers,
-- 
Luís

diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index 87c009e0c59a..c56b39a51865 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -897,7 +897,7 @@ static int ext4_fc_write_inode_data(struct inode *inode, u32 *crc)
 	int ret;
 
 	mutex_lock(&ei->i_fc_lock);
-	if (ei->i_fc_lblk_len == 0) {
+	if ((ei->i_fc_lblk_len == 0) || (ext4_has_inline_data(inode))) {
 		mutex_unlock(&ei->i_fc_lock);
 		return 0;
 	}

Back to linux.debian.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#1039883: linux: ext4 corruption with symlinks Luis Henriques <luis.henriques@linux.dev> - 2024-06-14 18:30 +0200
  Bug#1039883: linux: ext4 corruption with symlinks Luis Henriques <luis.henriques@linux.dev> - 2024-06-18 12:10 +0200
    Bug#1039883: linux: ext4 corruption with symlinks Luis Henriques <luis.henriques@linux.dev> - 2024-06-18 15:30 +0200

csiph-web