From: "Stephen C. Tweedie" <sct@redhat.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Andrew Morton <akpm@digeo.com>,
Nick Piggin <piggin@cyberone.com.au>,
lkml <linux-kernel@vger.kernel.org>,
ext3 users list <ext3-users@redhat.com>
Subject: Re: data corrupting bug in 2.4.20 ext3, data=journal
Date: 02 Dec 2002 15:37:22 +0000 [thread overview]
Message-ID: <1038843442.9666.221.camel@sisko.scot.redhat.com> (raw)
In-Reply-To: <1038831305.1852.102.camel@sisko.scot.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]
On Mon, 2002-12-02 at 12:15, Stephen C. Tweedie wrote:
> The problem is that ext3 is expecting that truncate_inode_pages() (and
> hence ext3_flushpage) is only called during a truncate. That's what the
> function is named for, after all, and it's the hint we need to indicate
> that future writeback on the data we're discarding should be disabled
> (so that we don't get old data written on top of new data should the
> block get deallocated.)
>
> But kill_supers() eventually calls truncate_inode_pages() too when we're
> doing the invalidate_inodes().
But we've already called fsync_super() at this point. If that completes
synchronously, then the buffers will already be out of the journal and
queued for writeback when we get here, and clearing BH_JBDDirty won't
have any dire consequences.
Indeed, loading the ext3 module with "do_sync_supers=1" cures the
symptoms.
However, doing every superblock write synchronously is a non-starter, as
that requires a journal commit in the ext3 universe, and so this would
essentially force bdflush to serialise all of its filesystem flushes
(which is a real problem once you've got a significant number of
filesystems mounted.) But the VFS simply doesn't have any clean way of
telling foo_write_super() whether the call needs to be completed
synchronously or asynchronously.
There *is* a totally unclean way, though. kill_super() sets sb->s_root
to NULL before calling its final fsync_super(), and ext3 can easily
check that in ext3_write_super(). It's a nasty, messy dependency, but
should work for 2.4 at least. For 2.5 we probably want to look at
passing an async flag down into the write_super.
The attached patch seems to fix things for me.
Cheers,
Stephen
[-- Attachment #2: Type: text/plain, Size: 598 bytes --]
--- linux-2.4-ext3merge/fs/ext3/super.c.=K0027=.orig 2002-12-02 15:35:13.000000000 +0000
+++ linux-2.4-ext3merge/fs/ext3/super.c 2002-12-02 15:35:14.000000000 +0000
@@ -1640,7 +1640,12 @@
sb->s_dirt = 0;
target = log_start_commit(EXT3_SB(sb)->s_journal, NULL);
- if (do_sync_supers) {
+ /*
+ * Tricky --- if we are unmounting, the write really does need
+ * to be synchronous. We can detect that by looking for NULL in
+ * sb->s_root.
+ */
+ if (do_sync_supers || !sb->s_root) {
unlock_super(sb);
log_wait_commit(EXT3_SB(sb)->s_journal, target);
lock_super(sb);
next prev parent reply other threads:[~2002-12-02 15:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-01 8:11 Andrew Morton
2002-12-01 8:52 ` Andrew Morton
2002-12-01 12:41 ` Nick Piggin
2002-12-02 7:17 ` Andrew Morton
2002-12-02 12:15 ` Stephen C. Tweedie
2002-12-02 15:37 ` Stephen C. Tweedie [this message]
2002-12-02 17:45 ` Andrew Morton
2002-12-02 8:26 ` Nick Piggin
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=1038843442.9666.221.camel@sisko.scot.redhat.com \
--to=sct@redhat.com \
--cc=akpm@digeo.com \
--cc=ext3-users@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=piggin@cyberone.com.au \
/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
all inboxes | Powered by JetHome®