Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Change cache_prune() to test for end-of-list before...



details:   https://anonhg.NetBSD.org/src/rev/038351545458
branches:  trunk
changeset: 326141:038351545458
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Jan 20 07:47:22 2014 +0000

description:
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.

diffstat:

 sys/kern/vfs_cache.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 36b5a0266038 -r 038351545458 sys/kern/vfs_cache.c
--- a/sys/kern/vfs_cache.c      Mon Jan 20 02:34:20 2014 +0000
+++ b/sys/kern/vfs_cache.c      Mon Jan 20 07:47:22 2014 +0000
@@ -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 @@
                        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 @@
                         */
                        tryharder = 1;
                }
+               if (ncp->nc_dvp == NULL)
+                       continue;
                if (!tryharder && (ncp->nc_hittime - recent) > 0) {
                        if (sentinel == NULL)
                                sentinel = ncp;



Home | Main Index | Thread Index | Old Index