Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Relax the dup alloc tests to not include the on-...



details:   https://anonhg.NetBSD.org/src/rev/68b6ad4dcf4d
branches:  trunk
changeset: 816139:68b6ad4dcf4d
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jun 19 22:41:31 2016 +0000

description:
Relax the dup alloc tests to not include the on-disk data for ffsv2, since
nothing checks that the lazy-initialized inodes are correct and if they happen
to get corrupted, there is no way to fix them.

diffstat:

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

diffs (77 lines):

diff -r 1847b1ccd445 -r 68b6ad4dcf4d sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Sun Jun 19 22:38:23 2016 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Sun Jun 19 22:41:31 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.338 2015/12/23 23:31:28 christos Exp $        */
+/*     $NetBSD: ffs_vfsops.c,v 1.339 2016/06/19 22:41:31 christos 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.338 2015/12/23 23:31:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.339 2016/06/19 22:41:31 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -765,7 +765,7 @@
        error = vinvalbuf(devvp, 0, cred, l, 0, 0);
        VOP_UNLOCK(devvp);
        if (error)
-               panic("ffs_reload: dirty1");
+               panic("%s: dirty1", __func__);
 
        /*
         * Step 2: re-read superblock from disk. XXX: We don't handle
@@ -922,7 +922,7 @@
                        continue;
                }
                if (vinvalbuf(vp, 0, cred, l, 0, 0))
-                       panic("ffs_reload: dirty2");
+                       panic("%s: dirty2", __func__);
                /*
                 * Step 6: re-read inode data for all active vnodes.
                 */
@@ -1902,8 +1902,7 @@
 
        fs = ump->um_fs;
        if (fs->fs_fmod != 0 && fs->fs_ronly != 0) {            /* XXX */
-               printf("fs = %s\n", fs->fs_fsmnt);
-               panic("update: rofs mod");
+               panic("%s: rofs mod, fs=%s", __func__, fs->fs_fsmnt);
        }
 
        fstrans_start(mp, FSTRANS_SHARED);
@@ -2141,14 +2140,22 @@
        }
 
        ip = VTOI(vp);
-       if (ip->i_mode || DIP(ip, size) || DIP(ip, blocks)) {
-               printf("free ino %" PRId64 " on %s:\n", ino, fs->fs_fsmnt);
-               printf("dmode %x mode %x dgen %x gen %x\n",
-                   DIP(ip, mode), ip->i_mode,
-                   DIP(ip, gen), ip->i_gen);
-               printf("size %" PRIx64 " blocks %" PRIx64 "\n",
-                   DIP(ip, size), DIP(ip, blocks));
-               panic("ffs_init_vnode: dup alloc");
+       if (ip->i_mode) {
+               panic("%s: dup alloc ino=%" PRId64 " on %s: mode %x/%x "
+                   "gen %x/%x size %" PRIx64 " blocks %" PRIx64,
+                   __func__, ino, fs->fs_fsmnt, DIP(ip, mode), ip->i_mode,
+                   DIP(ip, gen), ip->i_gen, DIP(ip, size), DIP(ip, blocks));
+       }
+       if (DIP(ip, size) || DIP(ip, blocks)) {
+               printf("%s: ino=%" PRId64 " on %s: "
+                   "gen %x/%x has non zero blocks %" PRIx64 " or size %"
+                   PRIx64 "\n",
+                   __func__, ino, fs->fs_fsmnt, DIP(ip, gen), ip->i_gen,
+                   DIP(ip, blocks), DIP(ip, size));
+               if ((ip)->i_ump->um_fstype == UFS1)
+                       panic("%s: dirty filesystem?", __func__);
+               DIP_ASSIGN(ip, blocks, 0);
+               DIP_ASSIGN(ip, size, 0);
        }
 
        /* Set uid / gid. */



Home | Main Index | Thread Index | Old Index