From 60a6965a88ac54f35a0b1f9562b5191657d74d04 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 15 Oct 2002 00:03:40 +0000 Subject: [PATCH] Remove the leaderp variable and just access p_leader directly. The p_leader field is not protected by the proc lock but is only set during fork1() by the parent process and never changes. --- sys/kern/kern_descrip.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index b464caf9ad15..ce7ae7786062 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -258,7 +258,6 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) struct flock *flp; int tmp, error = 0, flg = F_POSIX; u_int newmin; - struct proc *leaderp; mtx_lock(&Giant); @@ -379,9 +378,8 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) } PROC_LOCK(p); p->p_flag |= P_ADVLOCK; - leaderp = p->p_leader; PROC_UNLOCK(p); - error = VOP_ADVLOCK(vp, (caddr_t)leaderp, F_SETLK, + error = VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_SETLK, flp, flg); break; case F_WRLCK: @@ -389,18 +387,11 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) error = EBADF; break; } - PROC_LOCK(p); - p->p_flag |= P_ADVLOCK; - leaderp = p->p_leader; - PROC_UNLOCK(p); - error = VOP_ADVLOCK(vp, (caddr_t)leaderp, F_SETLK, flp, + error = VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_SETLK, flp, flg); break; case F_UNLCK: - PROC_LOCK(p); - leaderp = p->p_leader; - PROC_UNLOCK(p); - error = VOP_ADVLOCK(vp, (caddr_t)leaderp, F_UNLCK, flp, + error = VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_UNLCK, flp, F_POSIX); break; default: