From owner-freebsd-current Tue Jan 27 01:57:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id BAA20664 for current-outgoing; Tue, 27 Jan 1998 01:57:44 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from smtp02.primenet.com (smtp02.primenet.com [206.165.6.132]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id BAA20659 for ; Tue, 27 Jan 1998 01:57:42 -0800 (PST) (envelope-from tlambert@usr09.primenet.com) Received: (from daemon@localhost) by smtp02.primenet.com (8.8.8/8.8.8) id CAA12333 for ; Tue, 27 Jan 1998 02:57:38 -0700 (MST) Received: from usr09.primenet.com(206.165.6.209) via SMTP by smtp02.primenet.com, id smtpd012320; Tue Jan 27 02:57:34 1998 Received: (from tlambert@localhost) by usr09.primenet.com (8.8.5/8.8.5) id CAA04106 for freebsd-current@FreeBSD.ORG; Tue, 27 Jan 1998 02:57:33 -0700 (MST) From: Terry Lambert Message-Id: <199801270957.CAA04106@usr09.primenet.com> Subject: PATCH: Fixes for annoying VOP_LEASE bugs for NFS To: freebsd-current@FreeBSD.ORG Date: Tue, 27 Jan 1998 09:57:33 +0000 (GMT) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk Here are some of the obvious patches I am always on about. This should be a tiny enough chunk that even an application programmer can understand them. Someone please commit them. They should help with a few cases where NFSv3 is wierded out. The utility should be obvious. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. ========================================================================== Index: kern/kern_exec.c =================================================================== RCS file: /b/cvstree/ncvs/src/sys/kern/kern_exec.c,v retrieving revision 1.68 diff -c -r1.68 kern_exec.c *** 1.68 1997/11/06 19:29:08 --- kern_exec.c 1998/01/27 09:24:25 *************** *** 183,188 **** --- 183,189 ---- * header into it. */ imgp->image_header = malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + VOP_LEASE(imgp->vp, p, p->p_ucred, LEASE_READ); error = vn_rdwr(UIO_READ, imgp->vp, (void *)imgp->image_header, PAGE_SIZE, 0, UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p); /* Index: kern/kern_ktrace.c =================================================================== RCS file: /b/cvstree/ncvs/src/sys/kern/kern_ktrace.c,v retrieving revision 1.21 diff -c -r1.21 kern_ktrace.c *** 1.21 1997/11/06 19:29:10 --- kern_ktrace.c 1998/01/27 09:35:40 *************** *** 478,483 **** --- 478,484 ---- aiov[1].iov_len = kth->ktr_len; auio.uio_resid += kth->ktr_len; } + VOP_LEASE(vp, p, p->p_cred, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_WRITE(vp, &auio, IO_UNIT|IO_APPEND, p->p_ucred); VOP_UNLOCK(vp, 0, p); Index: kern/link_aout.c =================================================================== RCS file: /b/cvstree/ncvs/src/sys/kern/link_aout.c,v retrieving revision 1.4 diff -c -r1.4 link_aout.c *** 1.4 1997/11/07 08:52:59 --- link_aout.c 1998/01/27 09:27:23 *************** *** 116,121 **** --- 116,122 ---- /* * Read the a.out header from the file. */ + VOP_LEASE(nd.ni_vp, p, p->p_ucred, LEASE_READ); error = vn_rdwr(UIO_READ, nd.ni_vp, (void*) &header, sizeof header, 0, UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p); if (error) Index: kern/tty_tty.c =================================================================== RCS file: /b/cvstree/ncvs/src/sys/kern/tty_tty.c,v retrieving revision 1.19 diff -c -r1.19 tty_tty.c *** 1.19 1997/09/16 11:43:35 --- tty_tty.c 1998/01/27 09:06:19 *************** *** 128,133 **** --- 128,134 ---- if (ttyvp == NULL) return (EIO); + VOP_LEASE(ttyvp, p, NOCRED, LEASE_WRITE); vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_WRITE(ttyvp, uio, flag, NOCRED); VOP_UNLOCK(ttyvp, 0, p); Index: kern/vfs_vnops.c =================================================================== RCS file: /b/cvstree/ncvs/src/sys/kern/vfs_vnops.c,v retrieving revision 1.41 diff -c -r1.41 vfs_vnops.c *** 1.41 1997/11/07 08:53:11 --- vfs_vnops.c 1998/01/27 09:08:27 *************** *** 216,221 **** --- 216,224 ---- /* * Package up an I/O request on a vnode into a uio and do it. + * + * This function assumes the caller has done the appropriate + * VOP_LEASE() call prior to calling it. */ int vn_rdwr(rw, vp, base, len, offset, segflg, ioflg, cred, aresid, p) ==========================================================================