diff options
author | Pedro Martelletto <pedro@cvs.openbsd.org> | 2008-11-01 21:35:36 +0000 |
---|---|---|
committer | Pedro Martelletto <pedro@cvs.openbsd.org> | 2008-11-01 21:35:36 +0000 |
commit | f34583c53380b1727c462556497d46bbd36df940 (patch) | |
tree | bcdf5e95fc60b714c5b4fa80a0b68e222da4c24c | |
parent | eb6a8429d13e35ea08c9c9ae812e82f68f945cf1 (diff) |
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@.
-rw-r--r-- | sys/kern/kern_ktrace.c | 14 |
1 files 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); } /* |