Module Name:    src
Committed By:   hannken
Date:           Wed Aug  4 10:43:53 UTC 2010

Modified Files:
        src/sys/ufs/lfs: lfs_vnops.c

Log Message:
Free the on disk inodes in the reclaim routine.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/ufs/lfs/lfs_vnops.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/lfs/lfs_vnops.c
diff -u src/sys/ufs/lfs/lfs_vnops.c:1.230 src/sys/ufs/lfs/lfs_vnops.c:1.231
--- src/sys/ufs/lfs/lfs_vnops.c:1.230	Thu Jul 29 10:54:51 2010
+++ src/sys/ufs/lfs/lfs_vnops.c	Wed Aug  4 10:43:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vnops.c,v 1.230 2010/07/29 10:54:51 hannken Exp $	*/
+/*	$NetBSD: lfs_vnops.c,v 1.231 2010/08/04 10:43:53 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.230 2010/07/29 10:54:51 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.231 2010/08/04 10:43:53 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -277,6 +277,10 @@
 	if (fs->lfs_ronly)
 		return 0;
 
+	/* If a removed vnode is being cleaned, no need to sync here. */
+	if ((ap->a_flags & FSYNC_RECLAIM) != 0 && ip->i_mode == 0)
+		return 0;
+
 	/*
 	 * Trickle sync simply adds this vnode to the pager list, as if
 	 * the pagedaemon had requested a pageout.
@@ -1075,6 +1079,14 @@
 	struct lfs *fs = ip->i_lfs;
 	int error;
 
+	/*
+	 * The inode must be freed and updated before being removed
+	 * from its hash chain.  Other threads trying to gain a hold
+	 * on the inode will be stalled because it is locked (VI_XLOCK).
+	 */
+	if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
+		lfs_vfree(vp, ip->i_number, ip->i_omode);
+
 	mutex_enter(&lfs_lock);
 	LFS_CLR_UINO(ip, IN_ALLMOD);
 	mutex_exit(&lfs_lock);

Reply via email to