From: bugzilla-daemon@bugzilla.kernel.org
To: linux-ext4@vger.kernel.org
Subject: [Bug 211971] Incorrect fix by e2fsck for blocks_count corruption
Date: Sat, 27 Feb 2021 01:29:49 +0000 [thread overview]
Message-ID: <bug-211971-13602-gbjhQYQXM1@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-211971-13602@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=211971
--- Comment #2 from Theodore Tso (tytso@mit.edu) ---
On Fri, Feb 26, 2021 at 04:58:23PM -0800, Amy Parker wrote:
> Can you replicate this on modern 5.4 from kernel.org? -generic kernels
> are from Canonical and are sometimes broken compared to upstream. If
> you can't replicate this on mainline, you'll need to contact
> Canonical. We can't do anything if the problem only persists on
> distribution kernels.
This has nothing to do with the kernel. What the user is complaining
about is that e2fsck trusts the blocks count field in the superblock
as to be a source of truth. If that field is artificially changed to
be a smaller value, e2fsck will assume the file system size indicated
by that changed size.
That's an intentional design choice of e2fsck. Given that with modern
ext4 file systems, we have metadata checksums, if the superblock has
been accidentally corrupted, the checksum will fail, and then e2fsck
will try using the backup superblock instead.
For older file systems that don't have metadata checksums enabled, we
could check to see if certain "fundamental constants" in the primary
superblock is different from the secondary superblock, but...
> > debugfs -w image
> > debugfs: ssv blocks_count 4000
> > debugfs: q
This will update the blocks_count in the primary and all secondary
backups. So that's not going to really help the user. Effectively,
the complaint is "I pointed the gun at my foot, and pulled the
triggered, and now my foot hurts!"
> > # Expected that e2fsck would fix the blocks count corruption instead of
> > changing other fields (e.g.,free blocks_count)
The problem is that e2fsck can't really determine that the blocks
count field has been corrupted. We could warn the user if the
blocks_count is smaller than the reported size of the device,
but.... that's actually something that can happen in real life, and
it's not necessarily a file system "corruption", but rather an
intentional choice by the system administrator. If we were to give a
warning, or worse, assume that blocks count should be adjusted to be
the size of the deivce, we'd be getting complaints from users who
deliberately chose to set the file system size to be something smaller
than the block device.
So this is a case of e2fsck is working as intended.
Cheers,
- Ted
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
next prev parent reply other threads:[~2021-02-27 1:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 21:39 [Bug 211971] New: Incorrect fix by e2fsck for blocks_count corruption bugzilla-daemon
2021-02-27 0:58 ` Amy Parker
2021-02-27 1:29 ` Theodore Ts'o
2021-02-27 0:58 ` [Bug 211971] " bugzilla-daemon
2021-02-27 1:29 ` bugzilla-daemon [this message]
2021-03-03 17:14 ` bugzilla-daemon
2021-03-03 17:18 ` bugzilla-daemon
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=bug-211971-13602-gbjhQYQXM1@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@bugzilla.kernel.org \
--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 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).