All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <luis.henriques@linux.dev>
To: Luis Henriques <luis.henriques@linux.dev>
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>
Subject: Re: linux: ext4 corruption with symlinks
Date: Tue, 18 Jun 2024 10:52:55 +0100	[thread overview]
Message-ID: <87tthq37d4.fsf@brahms.olymp> (raw)
In-Reply-To: <87plsj4hwa.fsf@brahms.olymp> (Luis Henriques's message of "Fri, 14 Jun 2024 17:18:45 +0100")

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;
 	}

  reply	other threads:[~2024-06-18  9:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <168802788716.2369531.1979971093539266086.reportbug@ariane.home>
2023-07-01 15:35 ` Bug#1039883: linux-image-6.3.0-1-amd64: ext4 corruption with symlinks Salvatore Bonaccorso
     [not found] ` <ZL5DB7vU3GnIx588@eldamar.lan>
     [not found]   ` <2002858.macj2W6JUv@bagend>
     [not found]     ` <DB4PR02MB936085F4449207358A9943568FABA@DB4PR02MB9360.eurprd02.prod.outlook.com>
2024-06-10 16:03       ` linux: " Ben Hutchings
2024-06-14 16:18         ` Luis Henriques
2024-06-18  9:52           ` Luis Henriques [this message]
2024-06-18 13:19             ` Luis Henriques

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=87tthq37d4.fsf@brahms.olymp \
    --to=luis.henriques@linux.dev \
    --cc=1039883@bugs.debian.org \
    --cc=ben@decadent.org.uk \
    --cc=carnil@debian.org \
    --cc=didi.debian@cknow.org \
    --cc=dud225@hotmail.com \
    --cc=harshadshirwadkar@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.