Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jan 1998 09:57:33 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        freebsd-current@FreeBSD.ORG
Subject:   PATCH: Fixes for annoying VOP_LEASE bugs for NFS
Message-ID:  <199801270957.CAA04106@usr09.primenet.com>

next in thread | raw e-mail | index | archive | help
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)
==========================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801270957.CAA04106>