convert VOP_LOCK to vn_lock; add parameters to VOP_UNLOCK and vget;
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sun, 14 May 1995 15:24:40 +0000 (07:24 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sun, 14 May 1995 15:24:40 +0000 (07:24 -0800)
replace locking with calls to lock manager

SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 8.25
SCCS-vsn: sys/ufs/ufs/ufs_ihash.c 8.6

usr/src/sys/ufs/ufs/ufs_ihash.c
usr/src/sys/ufs/ufs/ufs_vnops.c

index 328634d..a74b260 100644 (file)
@@ -1,10 +1,10 @@
 /*
 /*
- * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993, 1995
  *     The Regents of the University of California.  All rights reserved.
  *
  * %sccs.include.redist.c%
  *
  *     The Regents of the University of California.  All rights reserved.
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_ihash.c 8.5 (Berkeley) %G%
+ *     @(#)ufs_ihash.c 8.6 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -23,6 +23,7 @@
 LIST_HEAD(ihashhead, inode) *ihashtbl;
 u_long ihash;          /* size of hash table - 1 */
 #define        INOHASH(device, inum)   (&ihashtbl[((device) + (inum)) & ihash])
 LIST_HEAD(ihashhead, inode) *ihashtbl;
 u_long ihash;          /* size of hash table - 1 */
 #define        INOHASH(device, inum)   (&ihashtbl[((device) + (inum)) & ihash])
+struct simplelock ufs_ihash_slock;
 
 /*
  * Initialize inode hash table.
 
 /*
  * Initialize inode hash table.
@@ -32,6 +33,7 @@ ufs_ihashinit()
 {
 
        ihashtbl = hashinit(desiredvnodes, M_UFSMNT, &ihash);
 {
 
        ihashtbl = hashinit(desiredvnodes, M_UFSMNT, &ihash);
+       simple_lock_init(&ufs_ihash_slock);
 }
 
 /*
 }
 
 /*
@@ -43,13 +45,17 @@ ufs_ihashlookup(dev, inum)
        dev_t dev;
        ino_t inum;
 {
        dev_t dev;
        ino_t inum;
 {
-       register struct inode *ip;
+       struct inode *ip;
 
 
-       for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) {
+       simple_lock(&ufs_ihash_slock);
+       for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next)
                if (inum == ip->i_number && dev == ip->i_dev)
                if (inum == ip->i_number && dev == ip->i_dev)
-                       return (ITOV(ip));
-       }
-       return (NULL);
+                       break;
+       simple_unlock(&ufs_ihash_slock);
+
+       if (ip)
+               return (ITOV(ip));
+       return (NULLVP);
 }
 
 /*
 }
 
 /*
@@ -61,23 +67,23 @@ ufs_ihashget(dev, inum)
        dev_t dev;
        ino_t inum;
 {
        dev_t dev;
        ino_t inum;
 {
-       register struct inode *ip;
+       struct proc *p = curproc;       /* XXX */
+       struct inode *ip;
        struct vnode *vp;
 
 loop:
        struct vnode *vp;
 
 loop:
+       simple_lock(&ufs_ihash_slock);
        for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) {
                if (inum == ip->i_number && dev == ip->i_dev) {
        for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) {
                if (inum == ip->i_number && dev == ip->i_dev) {
-                       if (ip->i_flag & IN_LOCKED) {
-                               ip->i_flag |= IN_WANTED;
-                               sleep(ip, PINOD);
-                               goto loop;
-                       }
                        vp = ITOV(ip);
                        vp = ITOV(ip);
-                       if (vget(vp, 1))
+                       simple_lock(&vp->v_interlock);
+                       simple_unlock(&ufs_ihash_slock);
+                       if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p))
                                goto loop;
                        return (vp);
                }
        }
                                goto loop;
                        return (vp);
                }
        }
+       simple_unlock(&ufs_ihash_slock);
        return (NULL);
 }
 
        return (NULL);
 }
 
@@ -88,17 +94,15 @@ void
 ufs_ihashins(ip)
        struct inode *ip;
 {
 ufs_ihashins(ip)
        struct inode *ip;
 {
+       struct proc *p = curproc;               /* XXX */
        struct ihashhead *ipp;
 
        struct ihashhead *ipp;
 
+       simple_lock(&ufs_ihash_slock);
        ipp = INOHASH(ip->i_dev, ip->i_number);
        LIST_INSERT_HEAD(ipp, ip, i_hash);
        ipp = INOHASH(ip->i_dev, ip->i_number);
        LIST_INSERT_HEAD(ipp, ip, i_hash);
-       if (ip->i_flag & IN_LOCKED)
-               panic("ufs_ihashins: already locked");
-       if (curproc)
-               ip->i_lockholder = curproc->p_pid;
-       else
-               ip->i_lockholder = -1;
-       ip->i_flag |= IN_LOCKED;
+       simple_unlock(&ufs_ihash_slock);
+
+       lockmgr(&ip->i_lock, LK_EXCLUSIVE, (struct simplelock *)0, p);
 }
 
 /*
 }
 
 /*
@@ -106,13 +110,15 @@ ufs_ihashins(ip)
  */
 void
 ufs_ihashrem(ip)
  */
 void
 ufs_ihashrem(ip)
-       register struct inode *ip;
+       struct inode *ip;
 {
 {
-       register struct inode *iq;
+       struct inode *iq;
 
 
+       simple_lock(&ufs_ihash_slock);
        LIST_REMOVE(ip, i_hash);
 #ifdef DIAGNOSTIC
        ip->i_hash.le_next = NULL;
        ip->i_hash.le_prev = NULL;
 #endif
        LIST_REMOVE(ip, i_hash);
 #ifdef DIAGNOSTIC
        ip->i_hash.le_next = NULL;
        ip->i_hash.le_prev = NULL;
 #endif
+       simple_unlock(&ufs_ihash_slock);
 }
 }
index 0c60af6..0f82f4c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 1982, 1986, 1989, 1993
+ * Copyright (c) 1982, 1986, 1989, 1993, 1995
  *     The Regents of the University of California.  All rights reserved.
  * (c) UNIX System Laboratories, Inc.
  * All or some portions of this file are derived from material licensed
  *     The Regents of the University of California.  All rights reserved.
  * (c) UNIX System Laboratories, Inc.
  * All or some portions of this file are derived from material licensed
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_vnops.c 8.24 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 8.25 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -93,9 +93,9 @@ ufs_mknod(ap)
                struct vattr *a_vap;
        } */ *ap;
 {
                struct vattr *a_vap;
        } */ *ap;
 {
-       register struct vattr *vap = ap->a_vap;
-       register struct vnode **vpp = ap->a_vpp;
-       register struct inode *ip;
+       struct vattr *vap = ap->a_vap;
+       struct vnode **vpp = ap->a_vpp;
+       struct inode *ip;
        int error;
 
        if (error =
        int error;
 
        if (error =
@@ -166,8 +166,10 @@ ufs_close(ap)
        register struct vnode *vp = ap->a_vp;
        register struct inode *ip = VTOI(vp);
 
        register struct vnode *vp = ap->a_vp;
        register struct inode *ip = VTOI(vp);
 
-       if (vp->v_usecount > 1 && !(ip->i_flag & IN_LOCKED))
+       simple_lock(&vp->v_interlock);
+       if (vp->v_usecount > 1)
                ITIMES(ip, &time, &time);
                ITIMES(ip, &time, &time);
+       simple_unlock(&vp->v_interlock);
        return (0);
 }
 
        return (0);
 }
 
@@ -180,19 +182,13 @@ ufs_access(ap)
                struct proc *a_p;
        } */ *ap;
 {
                struct proc *a_p;
        } */ *ap;
 {
-       register struct vnode *vp = ap->a_vp;
-       register struct inode *ip = VTOI(vp);
-       register struct ucred *cred = ap->a_cred;
+       struct vnode *vp = ap->a_vp;
+       struct inode *ip = VTOI(vp);
+       struct ucred *cred = ap->a_cred;
        mode_t mask, mode = ap->a_mode;
        register gid_t *gp;
        int i, error;
 
        mode_t mask, mode = ap->a_mode;
        register gid_t *gp;
        int i, error;
 
-#ifdef DIAGNOSTIC
-       if (!VOP_ISLOCKED(vp)) {
-               vprint("ufs_access: not locked", vp);
-               panic("ufs_access: not locked");
-       }
-#endif
 #ifdef QUOTA
        if (mode & VWRITE)
                switch (vp->v_type) {
 #ifdef QUOTA
        if (mode & VWRITE)
                switch (vp->v_type) {
@@ -307,11 +303,11 @@ ufs_setattr(ap)
                struct proc *a_p;
        } */ *ap;
 {
                struct proc *a_p;
        } */ *ap;
 {
-       register struct vattr *vap = ap->a_vap;
-       register struct vnode *vp = ap->a_vp;
-       register struct inode *ip = VTOI(vp);
-       register struct ucred *cred = ap->a_cred;
-       register struct proc *p = ap->a_p;
+       struct vattr *vap = ap->a_vap;
+       struct vnode *vp = ap->a_vp;
+       struct inode *ip = VTOI(vp);
+       struct ucred *cred = ap->a_cred;
+       struct proc *p = ap->a_p;
        struct timeval atimeval, mtimeval;
        int error;
 
        struct timeval atimeval, mtimeval;
        int error;
 
@@ -600,9 +596,9 @@ ufs_remove(ap)
                struct componentname *a_cnp;
        } */ *ap;
 {
                struct componentname *a_cnp;
        } */ *ap;
 {
-       register struct inode *ip;
-       register struct vnode *vp = ap->a_vp;
-       register struct vnode *dvp = ap->a_dvp;
+       struct inode *ip;
+       struct vnode *vp = ap->a_vp;
+       struct vnode *dvp = ap->a_dvp;
        int error;
 
        ip = VTOI(vp);
        int error;
 
        ip = VTOI(vp);
@@ -635,10 +631,11 @@ ufs_link(ap)
                struct componentname *a_cnp;
        } */ *ap;
 {
                struct componentname *a_cnp;
        } */ *ap;
 {
-       register struct vnode *vp = ap->a_vp;
-       register struct vnode *tdvp = ap->a_tdvp;
-       register struct componentname *cnp = ap->a_cnp;
-       register struct inode *ip;
+       struct vnode *vp = ap->a_vp;
+       struct vnode *tdvp = ap->a_tdvp;
+       struct componentname *cnp = ap->a_cnp;
+       struct proc *p = cnp->cn_proc;
+       struct inode *ip;
        struct timeval tv;
        int error;
 
        struct timeval tv;
        int error;
 
@@ -651,7 +648,7 @@ ufs_link(ap)
                error = EXDEV;
                goto out2;
        }
                error = EXDEV;
                goto out2;
        }
-       if (tdvp != vp && (error = VOP_LOCK(vp))) {
+       if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, p))) {
                VOP_ABORTOP(tdvp, cnp);
                goto out2;
        }
                VOP_ABORTOP(tdvp, cnp);
                goto out2;
        }
@@ -679,7 +676,7 @@ ufs_link(ap)
        FREE(cnp->cn_pnbuf, M_NAMEI);
 out1:
        if (tdvp != vp)
        FREE(cnp->cn_pnbuf, M_NAMEI);
 out1:
        if (tdvp != vp)
-               VOP_UNLOCK(vp);
+               VOP_UNLOCK(vp, 0, p);
 out2:
        vput(tdvp);
        return (error);
 out2:
        vput(tdvp);
        return (error);
@@ -781,10 +778,11 @@ ufs_rename(ap)
        struct vnode *tvp = ap->a_tvp;
        register struct vnode *tdvp = ap->a_tdvp;
        struct vnode *fvp = ap->a_fvp;
        struct vnode *tvp = ap->a_tvp;
        register struct vnode *tdvp = ap->a_tdvp;
        struct vnode *fvp = ap->a_fvp;
-       register struct vnode *fdvp = ap->a_fdvp;
-       register struct componentname *tcnp = ap->a_tcnp;
-       register struct componentname *fcnp = ap->a_fcnp;
-       register struct inode *ip, *xp, *dp;
+       struct vnode *fdvp = ap->a_fdvp;
+       struct componentname *tcnp = ap->a_tcnp;
+       struct componentname *fcnp = ap->a_fcnp;
+       struct proc *p = fcnp->cn_proc;
+       struct inode *ip, *xp, *dp;
        struct dirtemplate dirbuf;
        struct timeval tv;
        int doingdirectory = 0, oldparent = 0, newparent = 0;
        struct dirtemplate dirbuf;
        struct timeval tv;
        int doingdirectory = 0, oldparent = 0, newparent = 0;
@@ -846,12 +844,12 @@ abortit:
                (void) relookup(fdvp, &fvp, fcnp);
                return (VOP_REMOVE(fdvp, fvp, fcnp));
        }
                (void) relookup(fdvp, &fvp, fcnp);
                return (VOP_REMOVE(fdvp, fvp, fcnp));
        }
-       if (error = VOP_LOCK(fvp))
+       if (error = vn_lock(fvp, LK_EXCLUSIVE, p))
                goto abortit;
        dp = VTOI(fdvp);
        ip = VTOI(fvp);
        if ((ip->i_flags & (IMMUTABLE | APPEND)) || (dp->i_flags & APPEND)) {
                goto abortit;
        dp = VTOI(fdvp);
        ip = VTOI(fvp);
        if ((ip->i_flags & (IMMUTABLE | APPEND)) || (dp->i_flags & APPEND)) {
-               VOP_UNLOCK(fvp);
+               VOP_UNLOCK(fvp, 0, p);
                error = EPERM;
                goto abortit;
        }
                error = EPERM;
                goto abortit;
        }
@@ -862,7 +860,7 @@ abortit:
                if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
                    dp == ip || (fcnp->cn_flags&ISDOTDOT) ||
                    (ip->i_flag & IN_RENAME)) {
                if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
                    dp == ip || (fcnp->cn_flags&ISDOTDOT) ||
                    (ip->i_flag & IN_RENAME)) {
-                       VOP_UNLOCK(fvp);
+                       VOP_UNLOCK(fvp, 0, p);
                        error = EINVAL;
                        goto abortit;
                }
                        error = EINVAL;
                        goto abortit;
                }
@@ -891,7 +889,7 @@ abortit:
        ip->i_flag |= IN_CHANGE;
        tv = time;
        if (error = VOP_UPDATE(fvp, &tv, &tv, 1)) {
        ip->i_flag |= IN_CHANGE;
        tv = time;
        if (error = VOP_UPDATE(fvp, &tv, &tv, 1)) {
-               VOP_UNLOCK(fvp);
+               VOP_UNLOCK(fvp, 0, p);
                goto bad;
        }
 
                goto bad;
        }
 
@@ -906,7 +904,7 @@ abortit:
         * call to checkpath().
         */
        error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc);
         * call to checkpath().
         */
        error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc);
-       VOP_UNLOCK(fvp);
+       VOP_UNLOCK(fvp, 0, p);
        if (oldparent != dp->i_number)
                newparent = dp->i_number;
        if (doingdirectory && newparent) {
        if (oldparent != dp->i_number)
                newparent = dp->i_number;
        if (doingdirectory && newparent) {
@@ -1131,7 +1129,7 @@ bad:
 out:
        if (doingdirectory)
                ip->i_flag &= ~IN_RENAME;
 out:
        if (doingdirectory)
                ip->i_flag &= ~IN_RENAME;
-       if (VOP_LOCK(fvp) == 0) {
+       if (vn_lock(fvp, LK_EXCLUSIVE, p) == 0) {
                ip->i_nlink--;
                ip->i_flag |= IN_CHANGE;
                vput(fvp);
                ip->i_nlink--;
                ip->i_flag |= IN_CHANGE;
                vput(fvp);
@@ -1280,10 +1278,10 @@ ufs_rmdir(ap)
                struct componentname *a_cnp;
        } */ *ap;
 {
                struct componentname *a_cnp;
        } */ *ap;
 {
-       register struct vnode *vp = ap->a_vp;
-       register struct vnode *dvp = ap->a_dvp;
-       register struct componentname *cnp = ap->a_cnp;
-       register struct inode *ip, *dp;
+       struct vnode *vp = ap->a_vp;
+       struct vnode *dvp = ap->a_dvp;
+       struct componentname *cnp = ap->a_cnp;
+       struct inode *ip, *dp;
        int error;
 
        ip = VTOI(vp);
        int error;
 
        ip = VTOI(vp);
@@ -1544,78 +1542,31 @@ int
 ufs_lock(ap)
        struct vop_lock_args /* {
                struct vnode *a_vp;
 ufs_lock(ap)
        struct vop_lock_args /* {
                struct vnode *a_vp;
+               int a_flags;
+               struct proc *a_p;
        } */ *ap;
 {
        } */ *ap;
 {
-       register struct vnode *vp = ap->a_vp;
-       register struct inode *ip;
-       struct proc *p = curproc;       /* XXX */
+       struct vnode *vp = ap->a_vp;
 
 
-start:
-       while (vp->v_flag & VXLOCK) {
-               vp->v_flag |= VXWANT;
-               sleep((caddr_t)vp, PINOD);
-       }
-       if (vp->v_tag == VT_NON)
-               return (ENOENT);
-       ip = VTOI(vp);
-       if (ip->i_flag & IN_LOCKED) {
-               ip->i_flag |= IN_WANTED;
-#ifdef DIAGNOSTIC
-               if (p) {
-                       if (p->p_pid == ip->i_lockholder)
-                               panic("locking against myself");
-                       ip->i_lockwaiter = p->p_pid;
-               } else
-                       ip->i_lockwaiter = -1;
-#endif
-               (void) sleep((caddr_t)ip, PINOD);
-               goto start;
-       }
-#ifdef DIAGNOSTIC
-       ip->i_lockwaiter = 0;
-       if (ip->i_lockholder != 0)
-               panic("lockholder (%d) != 0", ip->i_lockholder);
-       if (p && p->p_pid == 0)
-               printf("locking by process 0\n");
-       if (p)
-               ip->i_lockholder = p->p_pid;
-       else
-               ip->i_lockholder = -1;
-#endif
-       ip->i_flag |= IN_LOCKED;
-       return (0);
+       return (lockmgr(&VTOI(vp)->i_lock, ap->a_flags, &vp->v_interlock,
+               ap->a_p));
 }
 
 /*
 }
 
 /*
- * Unlock an inode.  If WANT bit is on, wakeup.
+ * Unlock an inode.
  */
  */
-int lockcount = 90;
 int
 ufs_unlock(ap)
        struct vop_unlock_args /* {
                struct vnode *a_vp;
 int
 ufs_unlock(ap)
        struct vop_unlock_args /* {
                struct vnode *a_vp;
+               int a_flags;
+               struct proc *a_p;
        } */ *ap;
 {
        } */ *ap;
 {
-       register struct inode *ip = VTOI(ap->a_vp);
-       struct proc *p = curproc;       /* XXX */
+       struct vnode *vp = ap->a_vp;
 
 
-#ifdef DIAGNOSTIC
-       if ((ip->i_flag & IN_LOCKED) == 0) {
-               vprint("ufs_unlock: unlocked inode", ap->a_vp);
-               panic("ufs_unlock NOT LOCKED");
-       }
-       if (p && p->p_pid != ip->i_lockholder && p->p_pid > -1 &&
-           ip->i_lockholder > -1 && lockcount++ < 100)
-               panic("unlocker (%d) != lock holder (%d)",
-                   p->p_pid, ip->i_lockholder);
-       ip->i_lockholder = 0;
-#endif
-       ip->i_flag &= ~IN_LOCKED;
-       if (ip->i_flag & IN_WANTED) {
-               ip->i_flag &= ~IN_WANTED;
-               wakeup((caddr_t)ip);
-       }
-       return (0);
+       return (lockmgr(&VTOI(vp)->i_lock, ap->a_flags | LK_RELEASE,
+               &vp->v_interlock, ap->a_p));
 }
 
 /*
 }
 
 /*
@@ -1628,9 +1579,7 @@ ufs_islocked(ap)
        } */ *ap;
 {
 
        } */ *ap;
 {
 
-       if (VTOI(ap->a_vp)->i_flag & IN_LOCKED)
-               return (1);
-       return (0);
+       return (lockstatus(&VTOI(ap->a_vp)->i_lock));
 }
 
 /*
 }
 
 /*
@@ -1721,12 +1670,7 @@ ufs_print(ap)
        if (vp->v_type == VFIFO)
                fifo_printinfo(vp);
 #endif /* FIFO */
        if (vp->v_type == VFIFO)
                fifo_printinfo(vp);
 #endif /* FIFO */
-       printf("%s\n", (ip->i_flag & IN_LOCKED) ? " (LOCKED)" : "");
-       if (ip->i_lockholder == 0)
-               return (0);
-       printf("\towner pid %d", ip->i_lockholder);
-       if (ip->i_lockwaiter)
-               printf(" waiting pid %d", ip->i_lockwaiter);
+       lockmgr_printinfo(&ip->i_lock);
        printf("\n");
        return (0);
 }
        printf("\n");
        return (0);
 }
@@ -1785,10 +1729,13 @@ ufsspec_close(ap)
                struct proc *a_p;
        } */ *ap;
 {
                struct proc *a_p;
        } */ *ap;
 {
-       register struct inode *ip = VTOI(ap->a_vp);
+       struct vnode *vp = ap->a_vp;
+       struct inode *ip = VTOI(vp);
 
 
-       if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & IN_LOCKED))
+       simple_lock(&vp->v_interlock);
+       if (ap->a_vp->v_usecount > 1)
                ITIMES(ip, &time, &time);
                ITIMES(ip, &time, &time);
+       simple_unlock(&vp->v_interlock);
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_close), ap));
 }
 
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_close), ap));
 }
 
@@ -1849,10 +1796,13 @@ ufsfifo_close(ap)
        } */ *ap;
 {
        extern int (**fifo_vnodeop_p)();
        } */ *ap;
 {
        extern int (**fifo_vnodeop_p)();
-       register struct inode *ip = VTOI(ap->a_vp);
+       struct vnode *vp = ap->a_vp;
+       struct inode *ip = VTOI(vp);
 
 
-       if (ap->a_vp->v_usecount > 1 && !(ip->i_flag & IN_LOCKED))
+       simple_lock(&vp->v_interlock);
+       if (ap->a_vp->v_usecount > 1)
                ITIMES(ip, &time, &time);
                ITIMES(ip, &time, &time);
+       simple_unlock(&vp->v_interlock);
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_close), ap));
 }
 #endif /* FIFO */
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_close), ap));
 }
 #endif /* FIFO */
@@ -1995,6 +1945,7 @@ ufs_vinit(mntp, specops, fifoops, vpp)
        int (**fifoops)();
        struct vnode **vpp;
 {
        int (**fifoops)();
        struct vnode **vpp;
 {
+       struct proc *p = curproc;       /* XXX */
        struct inode *ip;
        struct vnode *vp, *nvp;
 
        struct inode *ip;
        struct vnode *vp, *nvp;
 
@@ -2009,7 +1960,7 @@ ufs_vinit(mntp, specops, fifoops, vpp)
                         * Discard unneeded vnode, but save its inode.
                         */
                        ufs_ihashrem(ip);
                         * Discard unneeded vnode, but save its inode.
                         */
                        ufs_ihashrem(ip);
-                       VOP_UNLOCK(vp);
+                       VOP_UNLOCK(vp, 0, p);
                        nvp->v_data = vp->v_data;
                        vp->v_data = NULL;
                        vp->v_op = spec_vnodeop_p;
                        nvp->v_data = vp->v_data;
                        vp->v_data = NULL;
                        vp->v_op = spec_vnodeop_p;