From: "Darrick J. Wong" <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: "Theodore Ts'o" <tytso-3s7WtUTddSA@public.gmane.org>
Cc: linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
lustre <lustre-devel-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org>
Subject: Re: [e2fsprogs PATCH] tune2fs: don't recover journal if device is busy.
Date: Mon, 26 Feb 2018 10:08:49 -0800 [thread overview]
Message-ID: <20180226180849.GA19295@magnolia> (raw)
In-Reply-To: <20180224222352.GC14111-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
On Sat, Feb 24, 2018 at 05:23:52PM -0500, Theodore Ts'o wrote:
> On Sun, Feb 11, 2018 at 06:16:09PM -0800, Darrick J. Wong wrote:
> > > Note: it seems wrong to recover the journal *after* making
> > > changes to the superblock - there is a good chance that
> > > recovering the journal will over-write those changes.
> > > This is what was happening that lead me to this problem.
> > > Shouldn't journal recovery happen *first*??
> >
> > Yes. Oops. :/
> >
> > This whole hunk ought to move up to be right after
> > ext2fs_check_if_mounted, I think.
>
> After I did that, the test t_replay_and_set started failing. The
> problem is that the test deliberately corrupts all of the inode and
> block bitmaps by writing bogus journal entries. When tune2fs replays
> the journal, it ends up smashing the inode and block bitmaps; but then
> when it tries to rewrite checksums, the fact that inode bitmap is
> completely zeroed out means all of the inode entries are also cleared
> out. Oops!
>
> This normally isn't supposed to happen because check_fsck_needed() is
> not supposed to allow us to do dangerous things that require rewriting
> checksums unless the file system is freshly checked.
>
> But the way the test was constructed the superblock's last mount time
> is still 0, since the file system was never mounted. By definition,
> though, if there is a journal to be replayed, the file system has been
> mounted, and hence must be checked. Once fixed I this to force
> s_lastcheck to be always less than s_mtimea after replaying the
> journal, then the t_replay_and_set test would fail because it's not
> safe to run "tune2fs -O ^metadata_csum" without running e2fsck first.
>
> So I'll change the test to set the file system label instead doing
> something more dangerous like clear the metadata checksum feature.
> Was there someone who really wanted to be able to execute "tune2fs -O
> ^metadata_csum" on a file system with a dirty journal w/o running
> e2fsck first?
No, I didn't have a specific user in mind. Frankly I doubt there will
be very many people who want to turn *off* that feature, but for those
who do so to a dirty fs we could replay the journal first.
(Though let's be honest, if you're going to tune2fs you really ought to
e2fsck before just to make sure the fs is ok...)
--D
>
> - Ted
prev parent reply other threads:[~2018-02-26 18:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 1:20 [e2fsprogs PATCH] tune2fs: don't recover journal if device is busy NeilBrown
2018-02-12 2:16 ` Darrick J. Wong
[not found] ` <20180224222352.GC14111@thunk.org>
[not found] ` <20180224222352.GC14111-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2018-02-26 18:08 ` Darrick J. Wong [this message]
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=20180226180849.GA19295@magnolia \
--to=darrick.wong-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lustre-devel-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org \
--cc=tytso-3s7WtUTddSA@public.gmane.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).