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/82671150b811
branches:  trunk
changeset: 829381:82671150b811
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 a8f673617c60 -r 82671150b811 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