in union_lock: don't lock lower layer when reference
authorJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Tue, 24 May 1994 19:43:05 +0000 (11:43 -0800)
committerJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Tue, 24 May 1994 19:43:05 +0000 (11:43 -0800)
count is zero.  this avoids deadlocking through getnewvnode/vgone.

SCCS-vsn: sys/miscfs/union/union_vnops.c 8.14

usr/src/sys/miscfs/union/union_vnops.c

index 01fd61a..b658362 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)union_vnops.c       8.13 (Berkeley) %G%
+ *     @(#)union_vnops.c       8.14 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -1233,7 +1233,8 @@ start:
        un = VTOUNION(vp);
 
        if (un->un_uppervp != NULLVP) {
        un = VTOUNION(vp);
 
        if (un->un_uppervp != NULLVP) {
-               if ((un->un_flags & UN_ULOCK) == 0) {
+               if (((un->un_flags & UN_ULOCK) == 0) &&
+                   (vp->v_usecount != 0)) {
                        un->un_flags |= UN_ULOCK;
                        VOP_LOCK(un->un_uppervp);
                }
                        un->un_flags |= UN_ULOCK;
                        VOP_LOCK(un->un_uppervp);
                }