Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ffs Make the recently added fs_cgsize test less stri...



details:   https://anonhg.NetBSD.org/src/rev/2b943f075ffe
branches:  trunk
changeset: 338315:2b943f075ffe
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 18 08:07:29 2015 +0000

description:
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.

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 04264f8a09f8 -r 2b943f075ffe sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Mon May 18 06:42:34 2015 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Mon May 18 08:07:29 2015 +0000
@@ -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 @@
 
        /* 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;
 }



Home | Main Index | Thread Index | Old Index