NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/45072: fsck_ext2fs dosn't work well with ext2fs's without alternate superblocks
>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
>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;
Home |
Main Index |
Thread Index |
Old Index