Module Name: src Committed By: martin Date: Mon May 18 08:07:30 UTC 2015
Modified Files: src/sys/ufs/ffs: ffs_vfsops.c Log Message: Make the recently added fs_cgsize test less strict, as it prevents existing installs from booting. Catch the common case and warn about it, pointing to a web page describing the issue - but allow mounting. In all other cases, print more details about the inconsistency and fail the mount. To generate a diff of this commit: cvs rdiff -u -r1.330 -r1.331 src/sys/ufs/ffs/ffs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/ffs/ffs_vfsops.c diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.330 src/sys/ufs/ffs/ffs_vfsops.c:1.331 --- src/sys/ufs/ffs/ffs_vfsops.c:1.330 Sun Apr 26 06:19:36 2015 +++ src/sys/ufs/ffs/ffs_vfsops.c Mon May 18 08:07:29 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.330 2015/04/26 06:19:36 maxv Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.331 2015/05/18 08:07:29 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.330 2015/04/26 06:19:36 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.331 2015/05/18 08:07:29 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -982,8 +982,21 @@ ffs_superblock_validate(struct fs *fs) /* Check the size of cylinder groups */ fs_cgsize = ffs_fragroundup(fs, CGSIZE(fs)); - if (fs->fs_cgsize != fs_cgsize) - return 0; + if (fs->fs_cgsize != fs_cgsize) { + if (fs->fs_cgsize+1 == CGSIZE(fs)) { + printf("CGSIZE(fs) miscalculated by one - this file " + "system may have been created by\n" + " an old (buggy) userland, see\n" + " http://www.netbsd.org/" + "docs/ffsv1badsuperblock.html\n"); + } else { + printf("ERROR: cylinder group size mismatch: " + "fs_cgsize = 0x%x, " + "fs->fs_cgsize = 0x%x, CGSIZE(fs) = 0x%lx\n", + fs_cgsize, fs->fs_cgsize, CGSIZE(fs)); + return 0; + } + } return 1; }