From f34583c53380b1727c462556497d46bbd36df940 Mon Sep 17 00:00:00 2001 From: Pedro Martelletto Date: Sat, 1 Nov 2008 21:35:36 +0000 Subject: Grab a reference to the trace vnode of the process when traversing the global process list and calling ktrsettracevnode() in ktrwrite(), so that we don't sleep in vrele(). Discussed with deraadt@, okay beck@, tedu@ and thib@. --- sys/kern/kern_ktrace.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 91ec8956813..1c38f7f85fc 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_ktrace.c,v 1.45 2008/10/31 17:17:02 deraadt Exp $ */ +/* $OpenBSD: kern_ktrace.c,v 1.46 2008/11/01 21:35:35 pedro Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */ /* @@ -466,11 +466,12 @@ ktrwrite(struct proc *p, struct ktr_header *kth) aiov[1].iov_len = kth->ktr_len; auio.uio_resid += kth->ktr_len; } - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vget(vp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_WRITE(vp, &auio, IO_UNIT|IO_APPEND, p->p_ucred); - VOP_UNLOCK(vp, 0, p); - if (!error) - return 0; + if (!error) { + vput(vp); + return (0); + } /* * If error encountered, give up tracing on this vnode. */ @@ -483,7 +484,8 @@ ktrwrite(struct proc *p, struct ktr_header *kth) } } - return error; + vput(vp); + return (error); } /* -- cgit v1.2.3