From 1abbd13bc2610a86a1eef7c8a73b314b2041b08e Mon Sep 17 00:00:00 2001 From: msmith Date: Mon, 7 Jun 1999 20:37:29 +0000 Subject: From the submitter: - this causes POSIX locking to use the thread group leader (p->p_leader) as the locking thread for all advisory locks. In non-kernel-threaded code p->p_leader == p, so this will have no effect. This results in (more) correct POSIX threaded flock-ing semantics. It also prevents the leader from exiting before any of the children. (so that p->p_leader will never be stale) in exit1(). We have been running this patch for over a month now in our lab under load and at customer sites. Submitted by: John Plevyak --- sys/kern/kern_descrip.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/kern/kern_descrip.c') diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index cc96d70..7b6ebe0 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 - * $Id: kern_descrip.c,v 1.62 1999/05/30 16:52:54 phk Exp $ + * $Id: kern_descrip.c,v 1.63 1999/05/31 11:27:30 phk Exp $ */ #include "opt_compat.h" @@ -304,16 +304,16 @@ fcntl(p, uap) if ((fp->f_flag & FREAD) == 0) return (EBADF); p->p_flag |= P_ADVLOCK; - return (VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &fl, flg)); + return (VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_SETLK, &fl, flg)); case F_WRLCK: if ((fp->f_flag & FWRITE) == 0) return (EBADF); p->p_flag |= P_ADVLOCK; - return (VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &fl, flg)); + return (VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_SETLK, &fl, flg)); case F_UNLCK: - return (VOP_ADVLOCK(vp, (caddr_t)p, F_UNLCK, &fl, + return (VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_UNLCK, &fl, F_POSIX)); default: @@ -334,7 +334,7 @@ fcntl(p, uap) return (EINVAL); if (fl.l_whence == SEEK_CUR) fl.l_start += fp->f_offset; - if ((error = VOP_ADVLOCK(vp,(caddr_t)p,F_GETLK,&fl,F_POSIX))) + if ((error = VOP_ADVLOCK(vp,(caddr_t)p->p_leader,F_GETLK,&fl,F_POSIX))) return (error); return (copyout((caddr_t)&fl, (caddr_t)(intptr_t)uap->arg, sizeof(fl))); @@ -1064,7 +1064,7 @@ closef(fp, p) lf.l_len = 0; lf.l_type = F_UNLCK; vp = (struct vnode *)fp->f_data; - (void) VOP_ADVLOCK(vp, (caddr_t)p, F_UNLCK, &lf, F_POSIX); + (void) VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_UNLCK, &lf, F_POSIX); } if (--fp->f_count > 0) return (0); -- cgit v1.1