Module Name:    src
Committed By:   hannken
Date:           Mon Jan 20 07:47:22 UTC 2014

Modified Files:
        src/sys/kern: vfs_cache.c

Log Message:
Change cache_prune() to test for end-of-list before testing for an
invalid entry.  Prevents a lifelock when the end-of-list marker
gets invalid while scanning the list and all entries are recent.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/kern/vfs_cache.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/kern/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.92 src/sys/kern/vfs_cache.c:1.93
--- src/sys/kern/vfs_cache.c:1.92	Tue Oct 29 09:53:51 2013
+++ src/sys/kern/vfs_cache.c	Mon Jan 20 07:47:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.92 2013/10/29 09:53:51 hannken Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.93 2014/01/20 07:47:22 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.92 2013/10/29 09:53:51 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.93 2014/01/20 07:47:22 hannken Exp $");
 
 #include "opt_ddb.h"
 #include "opt_revcache.h"
@@ -968,8 +968,6 @@ cache_prune(int incache, int target)
 			break;
 		items++;
 		nxtcp = TAILQ_NEXT(ncp, nc_lru);
-		if (ncp->nc_dvp == NULL)
-			continue;
 		if (ncp == sentinel) {
 			/*
 			 * If we looped back on ourself, then ignore
@@ -977,6 +975,8 @@ cache_prune(int incache, int target)
 			 */
 			tryharder = 1;
 		}
+		if (ncp->nc_dvp == NULL)
+			continue;
 		if (!tryharder && (ncp->nc_hittime - recent) > 0) {
 			if (sentinel == NULL)
 				sentinel = ncp;

Reply via email to