Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Require the actual namecache_look around cache_look...
details: https://anonhg.NetBSD.org/src/rev/deff0d66af60
branches: trunk
changeset: 329987:deff0d66af60
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Jun 16 12:28:10 2014 +0000
description:
Require the actual namecache_look around cache_lookup_entry.
Add one last case of missing stat locking.
diffstat:
sys/kern/vfs_cache.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (66 lines):
diff -r fee034c17839 -r deff0d66af60 sys/kern/vfs_cache.c
--- a/sys/kern/vfs_cache.c Mon Jun 16 09:55:49 2014 +0000
+++ b/sys/kern/vfs_cache.c Mon Jun 16 12:28:10 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_cache.c,v 1.98 2014/06/14 16:12:34 joerg Exp $ */
+/* $NetBSD: vfs_cache.c,v 1.99 2014/06/16 12:28:10 joerg 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.98 2014/06/14 16:12:34 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.99 2014/06/16 12:28:10 joerg Exp $");
#include "opt_ddb.h"
#include "opt_revcache.h"
@@ -286,8 +286,7 @@
}
/*
- * Find a single cache entry and return it locked. 'namecache_lock' or
- * at least one of the per-CPU locks must be held.
+ * Find a single cache entry and return it locked.
*/
static struct namecache *
cache_lookup_entry(const struct vnode *dvp, const char *name, size_t namelen)
@@ -297,6 +296,7 @@
nchash_t hash;
KASSERT(dvp != NULL);
+ KASSERT(mutex_owned(namecache_lock));
hash = cache_hash(name, namelen);
ncpp = &nchashtbl[NCHASH2(hash, dvp)];
@@ -395,7 +395,9 @@
/* found nothing */
return 0;
}
+ mutex_enter(namecache_lock);
ncp = cache_lookup_entry(dvp, name, namelen);
+ mutex_exit(namecache_lock);
if (__predict_false(ncp == NULL)) {
mutex_enter(&cpup->cpu_lock);
COUNT(cpup->cpu_stats, ncs_miss);
@@ -517,7 +519,9 @@
/* found nothing */
return 0;
}
+ mutex_enter(namecache_lock);
ncp = cache_lookup_entry(dvp, name, namelen);
+ mutex_exit(namecache_lock);
if (__predict_false(ncp == NULL)) {
mutex_enter(&cpup->cpu_lock);
COUNT(cpup->cpu_stats, ncs_miss);
@@ -559,7 +563,9 @@
}
/* Unlocked, but only for stats. */
+ mutex_enter(&cpup->cpu_lock);
COUNT(cpup->cpu_stats, ncs_goodhits); /* XXX can be "badhits" */
+ mutex_exit(&cpup->cpu_lock);
/* found it */
*vn_ret = vp;
Home |
Main Index |
Thread Index |
Old Index