linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: George Spelvin <linux@horizon.com>
Cc: linux-ext4@vger.kernel.org, tm@tao.ma
Subject: Re: metadata_csum + unclean shutdown = failure to boot
Date: Sun, 7 Oct 2012 18:54:03 -0400	[thread overview]
Message-ID: <20121007225403.GA468@thunk.org> (raw)
In-Reply-To: <20121007201830.29646.qmail@science.horizon.com>

If you can replicate this, could you try applying the following patch
to e2fsck, and install it and then capture the output from e2fsck when
it repairs the file system?

That might give us some clues as to what is going on.  I've been going
through the sources and I don't see any place where we mark the
superblock as dirty and write it out without first writing the
checksum first.

There is a chance we could get screwed by a race in no journal mode
where two processes modify superblock at the same time, but we don't
actually modify the superblock that much.  The primary case where the
superblock gets modified while the file system is mounted is when we
add and remove inods from the orphan list, and that is serialized by a
mutex.  The other times when we modify the superblock is when we add a
feature in a few rare cases (the large file feature, or the xattr
compat feature, etc.) and of course during an online resizing.  But
that's not likely to be happening in your case.  So I really don't
understand what might be happening on your system, which is why this
patch will hopefully shed some light as to what is going on.

      	   	     	       	     	- Ted

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index d2b1bbd..b1fe32c 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1064,6 +1064,13 @@ static errcode_t try_open_fs(e2fsck_t ctx, int flags, io_manager io_ptr,
 		retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options,
 				      flags, 0, 0, io_ptr, ret_fs);
 
+	if (*ret_fs && (*ret_fs)->super && retval == EXT2_ET_SB_CSUM_INVALID) {
+		list_super((*ret_fs)->super);
+		ext2fs_superblock_csum_set(*ret_fs, (*ret_fs)->super);
+		printf("Expected checksum was %04x\n",
+		       (*ret_fs)->super->s_checksum);
+	}
+
 	if (ret_fs)
 		e2fsck_set_bitmap_type(*ret_fs, EXT2FS_BMAP64_RBTREE,
 				       "default", NULL);

  reply	other threads:[~2012-10-07 22:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-07  5:04 metadata_csum + unclean shutdown = failure to boot George Spelvin
2012-10-07 13:39 ` Tao Ma
2012-10-07 15:09   ` George Spelvin
2012-10-07 18:10     ` Theodore Ts'o
2012-10-07 20:18       ` George Spelvin
2012-10-07 22:54         ` Theodore Ts'o [this message]
2012-10-08  1:05           ` George Spelvin
2012-10-08  1:25           ` George Spelvin
2012-10-08  2:41             ` Theodore Ts'o
2012-10-08  3:17               ` George Spelvin
2012-10-08  4:03                 ` Tao Ma
2012-10-08 11:35                   ` George Spelvin
2012-11-01  1:05               ` ext4: fix metadata checksum calculation for the superblock George Spelvin
2012-11-01  1:13                 ` Darrick J. Wong
2012-11-01  1:50                   ` Theodore Ts'o
2012-11-01  3:22                     ` Darrick J. Wong
2012-11-01  6:12                     ` George Spelvin
2012-11-01  6:49                       ` Darrick J. Wong
2012-11-01  7:07                         ` George Spelvin
2012-11-01  7:18                           ` Darrick J. Wong
2012-11-01  7:28                             ` George Spelvin
2012-11-02  0:05                               ` Darrick J. Wong

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=20121007225403.GA468@thunk.org \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=tm@tao.ma \
    /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).