From owner-freebsd-current Mon Dec 7 21:13:37 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA11205 for freebsd-current-outgoing; Mon, 7 Dec 1998 21:13:37 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.26.10.9]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA11197 for ; Mon, 7 Dec 1998 21:13:34 -0800 (PST) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id QAA16116; Tue, 8 Dec 1998 16:13:28 +1100 Date: Tue, 8 Dec 1998 16:13:28 +1100 From: Bruce Evans Message-Id: <199812080513.QAA16116@godzilla.zeta.org.au> To: rvb@cs.cmu.edu Subject: Re: Sloppy uio.uio_procp initialization ... Cc: freebsd-current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >Recently I fixed vnode_pager_input_old, because it was doing a >VOP_READ into a Coda fs, but it had set the uio.uio_procp to 0 vs >curproc. (Coda freaks because it vgets a vnode [and hence locks it >with curproc], then tries to unlock it with a 0 process pointer.) >I just noticed (the hard way) the same design happens in ktrwrite(): NetBSD doesn't pass a process pointer to the locking functions. When I looked at this in connection with some problems in quotaoff(), I deciced that NetBSD is correct, for the following reason: unlocking should only be done by the same process that holds the lock, except possibly during process exit and system shutdown, since unlocking another process' locks won't actually work while that process is still alive. Unlocking on behalf of another process during process exit and system shutdown apparently isn't needed (except probably when we shoot ourself in the foot by doing sync(&proc0, NULL) in boot() even in the non-panic case). Therefore, the process to use for unlocking is always given by curproc, and there is no need to waste time passing it to unlocking functions, and no way to use wrong values for it taken from uio.uio_procp. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message