From: "Theodore Ts'o" <tytso@mit.edu>
To: Ritesh Harjani <ritesh.list@gmail.com>
Cc: Sean Greenslade <sean@seangreenslade.com>,
Bagas Sanjaya <bagasdotme@gmail.com>,
linux-ext4@vger.kernel.org, Ye Bin <yebin10@huawei.com>,
Thorsten Leemhuis <regressions@leemhuis.info>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Regressions <regressions@lists.linux.dev>
Subject: Re: RO mount of ext4 filesystem causes writes
Date: Sat, 24 Jun 2023 15:39:24 -0400 [thread overview]
Message-ID: <20230624193924.GD8954@mit.edu> (raw)
In-Reply-To: <87leganq82.fsf@doe.com>
On Fri, Jun 23, 2023 at 09:08:37PM +0530, Ritesh Harjani wrote:
> It seems in the original code what we were trying to do was to preseve
> the error information area of superblock across journal load (which I am
> not sure why though?)
>
> In the new code we see if the journal load changed that area and if yes
> we change that back to original log but we also marked changed = true. Why?
That's a good question; thanks for asking it. The first part of this
code was introduced by commit 1c13d5c08728 ("ext4: Save error
information to the superblock for analysis") in 2010. So that part of
the code is not "new", but very, very, old.
The basic idea here was that back then, when a file system error was
detected, it was always written directly to the superblock, by passing
the journal. So that's why the original code saved the error
information, replayed the journal and then restored it.
Of course, this changed with commit 2d01ddc86606 ("ext4: save error
info to sb through journal if available") in 2020. But the problem is
"if available". If the jbd2 layer has shut down, then we can't route
the superblock error updates through the journal, at which point ext4
will do a direct update of the superlbock.
This was the rational behind commit eee00237fa5e ("ext4: commit super
block if fs record error when journal record without error").
Sometimes the error bit EXT4_ERROR_FS is set via a direct write to the
superblock; but other times the error bit might be set via the
journal. In the former case, after we do a journal replay, the error
bit will be cleared. However, since the kernel never clears the
EXT4_ERROR_FS bit, it's pretty easy for commit eee00237fa5e to handle
things.
So what we need to for that first part of the code, introduced in
commit 1c13d5c08728 and made invalid in commit 2d01ddc86606 is we need
to add code to examine s_last_error_time. If the version that was
originally in the superblock is newer than the version found after the
journal replay, then presumably an error happened but ext4 wasn't able
to write the error information out through the journal, and we need to
replace it after the the call to jbd2_journal_load().
Cheers,
- Ted
next prev parent reply other threads:[~2023-06-24 19:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 5:32 RO mount of ext4 filesystem causes writes Sean Greenslade
2023-06-12 6:20 ` Bagas Sanjaya
2023-06-13 4:48 ` Sean Greenslade
2023-06-23 1:06 ` Bagas Sanjaya
2023-06-23 4:46 ` Theodore Ts'o
2023-06-23 6:18 ` Sean Greenslade
2023-06-23 14:34 ` Theodore Ts'o
2023-06-23 15:38 ` Ritesh Harjani
2023-06-24 19:39 ` Theodore Ts'o [this message]
2023-06-23 16:53 ` Sean Greenslade
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=20230624193924.GD8954@mit.edu \
--to=tytso@mit.edu \
--cc=bagasdotme@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=regressions@leemhuis.info \
--cc=regressions@lists.linux.dev \
--cc=ritesh.list@gmail.com \
--cc=sean@seangreenslade.com \
--cc=yebin10@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;
as well as URLs for NNTP newsgroup(s).