Module Name:    src
Committed By:   hannken
Date:           Sun Jan 28 10:01:18 UTC 2018

Modified Files:
        src/sys/ufs/ufs: ufs_inode.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/ufs/ufs/ufs_inode.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/ufs/ufs_inode.c
diff -u src/sys/ufs/ufs/ufs_inode.c:1.102 src/sys/ufs/ufs/ufs_inode.c:1.103
--- src/sys/ufs/ufs/ufs_inode.c:1.102	Sat Oct 28 00:37:13 2017
+++ src/sys/ufs/ufs/ufs_inode.c	Sun Jan 28 10:01:18 2018
@@ -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 @@ out:
 	 */
 	*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);
 }
 

Reply via email to