Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/ad-namecache]: src/sys/kern vcache_reclaim(): purge namecache immediatel...
details: https://anonhg.NetBSD.org/src/rev/0176c8f7c121
branches: ad-namecache
changeset: 983007:0176c8f7c121
user: ad <ad%NetBSD.org@localhost>
date: Thu Jan 23 19:28:39 2020 +0000
description:
vcache_reclaim(): purge namecache immediately after setting vnode to
VS_RECLAIMED.
diffstat:
sys/kern/vfs_vnode.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diffs (42 lines):
diff -r 446e597987c8 -r 0176c8f7c121 sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c Thu Jan 23 12:33:18 2020 +0000
+++ b/sys/kern/vfs_vnode.c Thu Jan 23 19:28:39 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_vnode.c,v 1.105.2.3 2020/01/17 21:55:13 ad Exp $ */
+/* $NetBSD: vfs_vnode.c,v 1.105.2.4 2020/01/23 19:28:39 ad Exp $ */
/*-
* Copyright (c) 1997-2011, 2019 The NetBSD Foundation, Inc.
@@ -145,7 +145,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.3 2020/01/17 21:55:13 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.4 2020/01/23 19:28:39 ad Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -1582,6 +1582,13 @@
vp->v_iflag &= ~(VI_TEXT|VI_EXECMAP);
mutex_exit(vp->v_interlock);
+ /*
+ * With vnode state set to reclaiming, purge name cache immediately
+ * to prevent new handles on vnode, and wait for existing threads
+ * trying to get a handle to notice VS_RECLAIMED status and abort.
+ */
+ cache_purge(vp);
+
/* Replace the vnode key with a temporary copy. */
if (vip->vi_key.vk_key_len > sizeof(temp_buf)) {
temp_key = kmem_alloc(temp_key_len, KM_SLEEP);
@@ -1635,9 +1642,6 @@
vp->v_ractx = NULL;
}
- /* Purge name cache. */
- cache_purge(vp);
-
if (vip->vi_key.vk_key_len > 0) {
/* Remove from vnode cache. */
hash = vcache_hash(&vip->vi_key);
Home |
Main Index |
Thread Index |
Old Index