convert VOP_UNLOCK and vrele into vput's; add proc parameter to union_dircache
authorJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Fri, 19 May 1995 08:16:14 +0000 (00:16 -0800)
committerJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Fri, 19 May 1995 08:16:14 +0000 (00:16 -0800)
SCCS-vsn: sys/kern/vfs_syscalls.c 8.38

usr/src/sys/kern/vfs_syscalls.c

index 0fd1333..ca8d6e1 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)vfs_syscalls.c      8.37 (Berkeley) %G%
+ *     @(#)vfs_syscalls.c      8.38 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -610,11 +610,11 @@ fchdir(p, uap, retval)
                vput(vp);
                vp = tdp;
        }
                vput(vp);
                vp = tdp;
        }
-       VOP_UNLOCK(vp, 0, p);
        if (error) {
        if (error) {
-               vrele(vp);
+               vput(vp);
                return (error);
        }
                return (error);
        }
+       VOP_UNLOCK(vp, 0, p);
        vrele(fdp->fd_cdir);
        fdp->fd_cdir = vp;
        return (0);
        vrele(fdp->fd_cdir);
        fdp->fd_cdir = vp;
        return (0);
@@ -691,9 +691,10 @@ change_dir(ndp, p)
                error = ENOTDIR;
        else
                error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p);
                error = ENOTDIR;
        else
                error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p);
-       VOP_UNLOCK(vp, 0, p);
        if (error)
        if (error)
-               vrele(vp);
+               vput(vp);
+       else
+               VOP_UNLOCK(vp, 0, p);
        return (error);
 }
 
        return (error);
 }
 
@@ -2202,13 +2203,13 @@ unionread:
 #ifdef UNION
 {
        extern int (**union_vnodeop_p)();
 #ifdef UNION
 {
        extern int (**union_vnodeop_p)();
-       extern struct vnode *union_dircache __P((struct vnode *));
+       extern struct vnode *union_dircache __P((struct vnode*, struct proc*));
 
        if ((SCARG(uap, count) == auio.uio_resid) &&
            (vp->v_op == union_vnodeop_p)) {
                struct vnode *lvp;
 
 
        if ((SCARG(uap, count) == auio.uio_resid) &&
            (vp->v_op == union_vnodeop_p)) {
                struct vnode *lvp;
 
-               lvp = union_dircache(vp);
+               lvp = union_dircache(vp, p);
                if (lvp != NULLVP) {
                        struct vattr va;
 
                if (lvp != NULLVP) {
                        struct vattr va;
 
@@ -2225,12 +2226,11 @@ unionread:
                
                if (lvp != NULLVP) {
                        error = VOP_OPEN(lvp, FREAD, fp->f_cred, p);
                
                if (lvp != NULLVP) {
                        error = VOP_OPEN(lvp, FREAD, fp->f_cred, p);
-                       VOP_UNLOCK(lvp, 0, p);
-
                        if (error) {
                        if (error) {
-                               vrele(lvp);
+                               vput(lvp);
                                return (error);
                        }
                                return (error);
                        }
+                       VOP_UNLOCK(lvp, 0, p);
                        fp->f_data = (caddr_t) lvp;
                        fp->f_offset = 0;
                        error = vn_close(vp, FREAD, fp->f_cred, p);
                        fp->f_data = (caddr_t) lvp;
                        fp->f_offset = 0;
                        error = vn_close(vp, FREAD, fp->f_cred, p);
@@ -2310,13 +2310,13 @@ unionread:
 #ifdef UNION
 {
        extern int (**union_vnodeop_p)();
 #ifdef UNION
 {
        extern int (**union_vnodeop_p)();
-       extern struct vnode *union_dircache __P((struct vnode *));
+       extern struct vnode *union_dircache __P((struct vnode*, struct proc*));
 
        if ((SCARG(uap, count) == auio.uio_resid) &&
            (vp->v_op == union_vnodeop_p)) {
                struct vnode *lvp;
 
 
        if ((SCARG(uap, count) == auio.uio_resid) &&
            (vp->v_op == union_vnodeop_p)) {
                struct vnode *lvp;
 
-               lvp = union_dircache(vp);
+               lvp = union_dircache(vp, p);
                if (lvp != NULLVP) {
                        struct vattr va;
 
                if (lvp != NULLVP) {
                        struct vattr va;
 
@@ -2330,15 +2330,14 @@ unionread:
                                lvp = NULL;
                        }
                }
                                lvp = NULL;
                        }
                }
-               
+
                if (lvp != NULLVP) {
                        error = VOP_OPEN(lvp, FREAD, fp->f_cred, p);
                if (lvp != NULLVP) {
                        error = VOP_OPEN(lvp, FREAD, fp->f_cred, p);
-                       VOP_UNLOCK(lvp, 0, p);
-
                        if (error) {
                        if (error) {
-                               vrele(lvp);
+                               vput(lvp);
                                return (error);
                        }
                                return (error);
                        }
+                       VOP_UNLOCK(lvp, 0, p);
                        fp->f_data = (caddr_t) lvp;
                        fp->f_offset = 0;
                        error = vn_close(vp, FREAD, fp->f_cred, p);
                        fp->f_data = (caddr_t) lvp;
                        fp->f_offset = 0;
                        error = vn_close(vp, FREAD, fp->f_cred, p);