NetBSD Problem Report #45072
From www@NetBSD.org Fri Jun 17 04:14:10 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 8A16863C524
for <gnats-bugs@gnats.NetBSD.org>; Fri, 17 Jun 2011 04:14:10 +0000 (UTC)
Message-Id: <20110617041409.6CF2D63B970@www.NetBSD.org>
Date: Fri, 17 Jun 2011 04:14:09 +0000 (UTC)
From: jasper@pointless.net
Reply-To: jasper@pointless.net
To: gnats-bugs@NetBSD.org
Subject: fsck_ext2fs dosn't work well with ext2fs's without alternate superblocks
X-Send-Pr-Version: www-1.0
>Number: 45072
>Category: bin
>Synopsis: fsck_ext2fs dosn't work well with ext2fs's without alternate superblocks
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 17 04:15:00 +0000 2011
>Closed-Date:
>Last-Modified: Mon Apr 30 23:26:54 +0000 2012
>Originator: Jasper Wallace
>Release: 5.99.48
>Organization:
Pointless.net
>Environment:
NetBSD limpit 5.99.48 NetBSD 5.99.48 (GENERIC) #0: Fri Jun 10 20:46:16 BST 2011 jasper@limpit:/home/jasper/develop/netbsd/netbsd-src-and-build/tree/n.64/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
I dual boot my laptop between ubuntu and netbsd with my /home on ext2. At some point an ubunut upgrade changed /home to have alternate superblocks that are all zero's.
netbsd fsck_ext2fs dosn't like that, and core dumps when attempting to construct an alternate superblock cos i don't have fsize set in the disklabel (which i should probably have, but on the other hand fsck should cope gracefuly).
>How-To-Repeat:
run netbsd fsck_ext2fs against my /home.
N.B. i'm not sure of the sequence of events that produced this file system, i don't know if a modern mke2fs would do the same thing.
It may of been made with the sparse_super option, however fsck.ext2 (the linux version) dosn't find an alternate superblocks either.
>Fix:
Index: setup.c
===================================================================
RCS file: /cvsroot/src/sbin/fsck_ext2fs/setup.c,v
retrieving revision 1.27
diff -u -r1.27 setup.c
--- setup.c 19 Oct 2009 18:41:08 -0000 1.27
+++ setup.c 17 Jun 2011 03:52:48 -0000
@@ -352,6 +352,17 @@
return 1;
}
+ if (asblk.b_un.b_fs->e2fs_magic != E2FS_MAGIC) {
+ /* the alternate super-block dosn't have the e2fs magic,
+ * so ignore it.
+ *
+ * XXX e2fsck checks all the superblocks in the system
+ * rather than giving up on the first one
+ *
+ */
+ return 1;
+ }
+
/*
* Set all possible fields that could differ, then do check
* of whole super block against an alternate super block.
@@ -490,6 +501,10 @@
fstypenames[pp->p_fstype] : "unknown");
return 0;
}
+ if (pp->p_fsize == 0) {
+ pfatal("%s: no fsize set in disklabel.\n", dev);
+ return 0;
+ }
memset(fs, 0, sizeof(struct m_ext2fs));
fs->e2fs_bsize = pp->p_fsize;
fs->e2fs.e2fs_log_bsize = pp->p_fsize / 1024;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 17 Jun 2011 17:19:45 +0000
State-Changed-Why:
Can you clear up with the linux ext2fs folks what the correct behavior of
linux e2fsck should be? Properly fsck should repair a state like this, but
I'm afraid that doing so might corrupt the fs, and we're not the authorities
on the behavior of ext2fs.
One possibility suggested was that the volume might have gotten resized,
which would move the alternate superblocks. Another possibility is that
Ubuntu did something ext4-related that our ext2 tools don't understand.
However, you don't want to be in a situation with no alternate superblocks,
so do clear it up with the linux guys.
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: dholland@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: bin/45072 (fsck_ext2fs dosn't work well with ext2fs's without alternate
superblocks)
Date: Sat, 18 Jun 2011 02:33:22 +0900
> Can you clear up with the linux ext2fs folks what the correct behavior of
> linux e2fsck should be?
I'm afraid there is no proper documents other than sources of e2fsprogs..
> One possibility suggested was that the volume might have gotten resized,
> which would move the alternate superblocks.
IIUC ext2fs uses a fixed block number per block group (cylinder group)
so alternate superblocks are always allocated at the same blocks even
after resize if block size is not changed.
(see also cg_has_sb() in <ufs/ext2fs/ext2fs.h>)
> Another possibility is that
> Ubuntu did something ext4-related that our ext2 tools don't understand.
At least fsck_ext2fs(8) seems to check INCOMPATIBLE FEATURE bits
in superblock. (though I'm not sure how Linux guys take care
of backward compatibititty)
---
Izumi Tsutsui
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45072 (fsck_ext2fs dosn't work well with ext2fs's without
alternate superblocks)
Date: Wed, 22 Jun 2011 04:12:02 +0000
On Fri, Jun 17, 2011 at 05:35:02PM +0000, Izumi Tsutsui wrote:
>> Can you clear up with the linux ext2fs folks what the correct behavior of
>> linux e2fsck should be?
>
> I'm afraid there is no proper documents other than sources of e2fsprogs..
There are, however, ext2/3/4 developers who do frequently answer bug
reports.
One thing one of them suggested to me: there's a tool in e2fsprogs to
find superblocks; running that will probably be informative.
>> Another possibility is that
>> Ubuntu did something ext4-related that our ext2 tools don't understand.
>
> At least fsck_ext2fs(8) seems to check INCOMPATIBLE FEATURE bits
> in superblock. (though I'm not sure how Linux guys take care
> of backward compatibititty)
...right.
--
David A. Holland
dholland@netbsd.org
State-Changed-From-To: feedback->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 30 Apr 2012 23:26:54 +0000
State-Changed-Why:
No response from submitter. Someone (TM) needs to talk to the
Linux ext* guys to figure out what the right behavior is.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.