Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Add flag VRELEL_FORCE_RELE to vrelel() to force rel...
details: https://anonhg.NetBSD.org/src/rev/7fd71a6f0086
branches: trunk
changeset: 352399:7fd71a6f0086
user: hannken <hannken%NetBSD.org@localhost>
date: Thu Mar 30 09:14:08 2017 +0000
description:
Add flag VRELEL_FORCE_RELE to vrelel() to force release and
use it from vdrain_vrele() and vrele_flush() to prevent a
possible live lock from vrele_flush().
diffstat:
sys/kern/vfs_vnode.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diffs (76 lines):
diff -r 665d4198f944 -r 7fd71a6f0086 sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c Thu Mar 30 09:13:37 2017 +0000
+++ b/sys/kern/vfs_vnode.c Thu Mar 30 09:14:08 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_vnode.c,v 1.77 2017/03/30 09:12:21 hannken Exp $ */
+/* $NetBSD: vfs_vnode.c,v 1.78 2017/03/30 09:14:08 hannken Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.77 2017/03/30 09:12:21 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.78 2017/03/30 09:14:08 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -184,6 +184,7 @@
/* Flags to vrelel. */
#define VRELEL_ASYNC_RELE 0x0001 /* Always defer to vrele thread. */
+#define VRELEL_FORCE_RELE 0x0002 /* Must always succeed. */
u_int numvnodes __cacheline_aligned;
@@ -482,7 +483,8 @@
TAILQ_INSERT_TAIL(vip->vi_lrulisthd, vip, vi_lrulist);
mutex_exit(&vdrain_lock);
- vrele(VIMPL_TO_VNODE(vip));
+ mutex_enter(VIMPL_TO_VNODE(vip)->v_interlock);
+ vrelel(VIMPL_TO_VNODE(vip), VRELEL_FORCE_RELE);
mutex_enter(&vdrain_lock);
}
@@ -523,8 +525,10 @@
mutex_exit(&vdrain_lock);
if (vcache_vget(vp) == 0) {
- if (!vrecycle(vp))
- vrele(vp);
+ if (!vrecycle(vp)) {
+ mutex_enter(vp->v_interlock);
+ vrelel(vp, VRELEL_FORCE_RELE);
+ }
}
fstrans_done(mp);
@@ -561,7 +565,7 @@
mutex_exit(&vdrain_lock);
mutex_enter(vp->v_interlock);
- vrelel(vp, 0);
+ vrelel(vp, VRELEL_FORCE_RELE);
fstrans_done(mp);
mutex_enter(&vdrain_lock);
@@ -704,7 +708,7 @@
if ((curlwp == uvm.pagedaemon_lwp) ||
(flags & VRELEL_ASYNC_RELE) != 0) {
defer = true;
- } else if (curlwp == vdrain_lwp) {
+ } else if ((flags & VRELEL_FORCE_RELE) != 0) {
/*
* We have to try harder.
*/
@@ -723,7 +727,7 @@
}
KASSERT(mutex_owned(vp->v_interlock));
- KASSERT(! (curlwp == vdrain_lwp && defer));
+ KASSERT(! ((flags & VRELEL_FORCE_RELE) != 0 && defer));
if (defer) {
/*
Home |
Main Index |
Thread Index |
Old Index