All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Andreas Dilger <adilger@sun.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] e2fsck shouln't consider superblock summaries as fatal
Date: Wed, 27 Aug 2008 09:44:25 -0400	[thread overview]
Message-ID: <20080827134425.GA29950@mit.edu> (raw)
In-Reply-To: <20080827073242.GU3392@webber.adilger.int>

On Wed, Aug 27, 2008 at 01:32:42AM -0600, Andreas Dilger wrote:
> I don't think this is the issue at all.  It isn't that the journal has the
> right summary values either, otherwise waiting 1 commit interval would
> be enough.  The issue is that the kernel NEVER updates the summaries
> by itself, so the effort to replay the journal in memory would be cool,
> but wouldn't help at all.

If you reboot and replay the journal, the summary values are right.
So the correct values are indeed in the journal.  The problem is that
we *never* write the superblock to disk, but only to the journal.
Consider:

/*
 * Ext3 always journals updates to the superblock itself, so we don't
 * have to propagate any other updates to the superblock on disk at this
 * point.  Just start an async writeback to get the buffers on their way
 * to the disk.
 *
 * This implicitly triggers the writebehind on sync().
 */

static void ext3_write_super (struct super_block * sb)
{
	if (mutex_trylock(&sb->s_lock) != 0)
		BUG();
	sb->s_dirt = 0;
}

The comment is a little out of date, since we don't even start an
async writeback these days.  All ext3_write_super does is mark the
superblock as non-dirty, so we are 100% dependent on the summary
values getting written to the journal.  Even if we call fsync on the
filesystem, we don't actually write the superblock to its permanent
location on disk, but only to the journal.

static int ext3_sync_fs(struct super_block *sb, int wait)
{
	tid_t target;

	sb->s_dirt = 0;
	if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) {
		if (wait)
			log_wait_commit(EXT3_SB(sb)->s_journal, target);
	}
	return 0;
}

It's only if we unmount or freeze the filesystem that we call
ext3_commit_super().

						- Ted

      reply	other threads:[~2008-08-27 13:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26 10:45 [PATCH] e2fsck shouln't consider superblock summaries as fatal Andreas Dilger
2008-08-26 14:58 ` Eric Sandeen
2008-08-26 17:04 ` Theodore Tso
2008-08-26 21:27   ` Andreas Dilger
2008-08-27  0:25     ` Theodore Tso
2008-08-27  7:32       ` Andreas Dilger
2008-08-27 13:44         ` Theodore Tso [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=20080827134425.GA29950@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger@sun.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.