Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ufs Make sure inode blocks and size are zero when VO...



details:   https://anonhg.NetBSD.org/src/rev/0b0e40e2e2d6
branches:  trunk
changeset: 359080:0b0e40e2e2d6
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun Jan 28 10:01:18 2018 +0000

description:
Make sure inode blocks and size are zero when VOP_INACTIVE()
finalises a now unlinked inode.
Counterpart of the check in ffs_newvnode().

diffstat:

 sys/ufs/ufs/ufs_inode.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r f850d2d7559c -r 0b0e40e2e2d6 sys/ufs/ufs/ufs_inode.c
--- a/sys/ufs/ufs/ufs_inode.c   Sun Jan 28 10:00:31 2018 +0000
+++ b/sys/ufs/ufs/ufs_inode.c   Sun Jan 28 10:01:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_inode.c,v 1.102 2017/10/28 00:37:13 pgoyette Exp $ */
+/*     $NetBSD: ufs_inode.c,v 1.103 2018/01/28 10:01:18 hannken Exp $  */
 
 /*
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.102 2017/10/28 00:37:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.103 2018/01/28 10:01:18 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -149,6 +149,15 @@
         */
        *ap->a_recycle = (ip->i_mode == 0);
 
+       if (ip->i_mode == 0 && (DIP(ip, size) != 0 || DIP(ip, blocks) != 0)) {
+               printf("%s: unlinked ino %" PRId64 " on \"%s\" has"
+                   " non zero size %" PRIx64 " or blocks %" PRIx64
+                   " with allerror %d\n",
+                   __func__, ip->i_number, mp->mnt_stat.f_mntonname,
+                   DIP(ip, size), DIP(ip, blocks), allerror);
+               panic("%s: dirty filesystem?", __func__);
+       }
+
        return (allerror);
 }
 



Home | Main Index | Thread Index | Old Index