Fixed nfs bug that was pointed out by
[unix-history] / sys / nfs / nfs_node.c
index 810378e..bac5898 100644 (file)
@@ -33,7 +33,8 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     @(#)nfs_node.c  7.34 (Berkeley) 5/15/91
+ *     From:   @(#)nfs_node.c  7.34 (Berkeley) 5/15/91
+ *     $Id: nfs_node.c,v 1.3 1993/11/25 01:36:48 wollman Exp $
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -72,6 +73,7 @@ union nhead {
  * Initialize hash links for nfsnodes
  * and build nfsnode free list.
  */
  * Initialize hash links for nfsnodes
  * and build nfsnode free list.
  */
+void
 nfs_nhinit()
 {
        register int i;
 nfs_nhinit()
 {
        register int i;
@@ -111,6 +113,7 @@ nfs_hash(fhp)
  * In all cases, a pointer to a
  * nfsnode structure is returned.
  */
  * In all cases, a pointer to a
  * nfsnode structure is returned.
  */
+int
 nfs_nget(mntp, fhp, npp)
        struct mount *mntp;
        register nfsv2fh_t *fhp;
 nfs_nget(mntp, fhp, npp)
        struct mount *mntp;
        register nfsv2fh_t *fhp;
@@ -159,10 +162,12 @@ loop:
        np->n_sillyrename = (struct sillyrename *)0;
        np->n_size = 0;
        np->n_mtime = 0;
        np->n_sillyrename = (struct sillyrename *)0;
        np->n_size = 0;
        np->n_mtime = 0;
+       np->n_lockf = 0;
        *npp = np;
        return (0);
 }
 
        *npp = np;
        return (0);
 }
 
+int
 nfs_inactive(vp, p)
        struct vnode *vp;
        struct proc *p;
 nfs_inactive(vp, p)
        struct vnode *vp;
        struct proc *p;
@@ -219,6 +224,7 @@ nfs_inactive(vp, p)
 /*
  * Reclaim an nfsnode so that it can be used for other purposes.
  */
 /*
  * Reclaim an nfsnode so that it can be used for other purposes.
  */
+int
 nfs_reclaim(vp)
        register struct vnode *vp;
 {
 nfs_reclaim(vp)
        register struct vnode *vp;
 {
@@ -244,17 +250,18 @@ nfs_reclaim(vp)
  * for doing it just in case it is needed.
  */
 int donfslocking = 0;
  * for doing it just in case it is needed.
  */
 int donfslocking = 0;
+
 /*
  * Lock an nfsnode
  */
 /*
  * Lock an nfsnode
  */
-
+int
 nfs_lock(vp)
        struct vnode *vp;
 {
        register struct nfsnode *np = VTONFS(vp);
 
        if (!donfslocking)
 nfs_lock(vp)
        struct vnode *vp;
 {
        register struct nfsnode *np = VTONFS(vp);
 
        if (!donfslocking)
-               return;
+               return 0;
        while (np->n_flag & NLOCKED) {
                np->n_flag |= NWANT;
                if (np->n_lockholder == curproc->p_pid)
        while (np->n_flag & NLOCKED) {
                np->n_flag |= NWANT;
                if (np->n_lockholder == curproc->p_pid)
@@ -265,11 +272,13 @@ nfs_lock(vp)
        np->n_lockwaiter = 0;
        np->n_lockholder = curproc->p_pid;
        np->n_flag |= NLOCKED;
        np->n_lockwaiter = 0;
        np->n_lockholder = curproc->p_pid;
        np->n_flag |= NLOCKED;
+       return(0);
 }
 
 /*
  * Unlock an nfsnode
  */
 }
 
 /*
  * Unlock an nfsnode
  */
+int
 nfs_unlock(vp)
        struct vnode *vp;
 {
 nfs_unlock(vp)
        struct vnode *vp;
 {
@@ -281,11 +290,13 @@ nfs_unlock(vp)
                np->n_flag &= ~NWANT;
                wakeup((caddr_t)np);
        }
                np->n_flag &= ~NWANT;
                wakeup((caddr_t)np);
        }
+       return(0);
 }
 
 /*
  * Check for a locked nfsnode
  */
 }
 
 /*
  * Check for a locked nfsnode
  */
+int
 nfs_islocked(vp)
        struct vnode *vp;
 {
 nfs_islocked(vp)
        struct vnode *vp;
 {
@@ -300,6 +311,7 @@ nfs_islocked(vp)
  * since I can't decide if dirs. should be locked, I will check for
  * the lock and be flexible
  */
  * since I can't decide if dirs. should be locked, I will check for
  * the lock and be flexible
  */
+void
 nfs_nput(vp)
        struct vnode *vp;
 {
 nfs_nput(vp)
        struct vnode *vp;
 {
@@ -315,6 +327,7 @@ nfs_nput(vp)
  * done. Currently nothing to do.
  */
 /* ARGSUSED */
  * done. Currently nothing to do.
  */
 /* ARGSUSED */
+int
 nfs_abortop(ndp)
        struct nameidata *ndp;
 {
 nfs_abortop(ndp)
        struct nameidata *ndp;
 {