summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1997-04-26 04:09:40 +0000
committerkato <kato@FreeBSD.org>1997-04-26 04:09:40 +0000
commitf18676ff22d9297535b2acd920192c055db4ae2d (patch)
tree086af2b8fcb3c6b10e0beb3795c05ec0f22ed28f /sys/miscfs
parent80b96ecb2f86cc9a64bc39f7b7afb0f052645aef (diff)
downloadFreeBSD-src-f18676ff22d9297535b2acd920192c055db4ae2d.zip
FreeBSD-src-f18676ff22d9297535b2acd920192c055db4ae2d.tar.gz
Do not clear UN_ULOCK in certain case.
Our vput calls vm_object_deallocate() --> vm_object_terminate(). The vm_object_terminate() calls vn_lock(), since UN_LOCKED has been already cleared in union_unlock(). Then, union_lock locks upper vnode when UN_ULOCK is not set. The upper vnode is not unlocked when UN_KLOCK is set in union_unlock(), thus, union_lock tries to lock locked vnode and we get panic.
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/union/union_vnops.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c
index e90c5d49..cc632a2 100644
--- a/sys/miscfs/union/union_vnops.c
+++ b/sys/miscfs/union/union_vnops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vnops.c 8.32 (Berkeley) 6/23/95
- * $Id: union_vnops.c,v 1.26 1997/04/21 12:40:42 kato Exp $
+ * $Id: union_vnops.c,v 1.27 1997/04/21 15:32:24 kato Exp $
*/
#include <sys/param.h>
@@ -1492,6 +1492,7 @@ start:
panic("union_link: upper vnode is locked, "
"but UN_UNLOCK is not set.");
#endif
+ printf("union_lock: adjust un_flags\n");
un->un_flags |= UN_ULOCK; /* Adjust -- dirty */
} else {
error = vn_lock(un->un_uppervp, flags, p);
@@ -1565,7 +1566,16 @@ union_unlock(ap)
if ((un->un_flags & (UN_ULOCK|UN_KLOCK)) == UN_ULOCK)
VOP_UNLOCK(un->un_uppervp, 0, p);
- un->un_flags &= ~(UN_ULOCK|UN_KLOCK);
+ if ((un->un_flags & UN_KLOCK) && (ap->a_vp->v_usecount == 1)) {
+ /*
+ * Do not clear UN_ULOCK here. Our vput will call
+ * VOP_LOCK for vm related reason. If we clear UN_ULOCK,
+ * VOP_LOCK will try to lock upper vnode, whic is not
+ * unlocked.
+ */
+ un->un_flags &= ~UN_KLOCK;
+ } else
+ un->un_flags &= ~(UN_ULOCK|UN_KLOCK);
if (un->un_flags & UN_WANT) {
un->un_flags &= ~UN_WANT;
OpenPOWER on IntegriCloud