possible patch for vnode double unlock in pfs_lookup()

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Wed, 21 May 2003 23:20:49 -0700 (PDT)
If the ISDOTDOT flag is set and the lockparent or ISLASTCN flags are not
set, pfs_lookup() unlocks the same vnode twice.  This can be observed by
running
	find / -print
with the DEBUG_VFS_LOCKS kernel option enabled.

I think the following is the correct patch:

I believe that it is safe to defer committing a fix until after
5.1-RELEASE.


Index: sys/fs/pseudofs/pseudofs_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/pseudofs/pseudofs_vnops.c,v
retrieving revision 1.35
diff -u -r1.35 pseudofs_vnops.c
--- sys/fs/pseudofs/pseudofs_vnops.c	2 Mar 2003 22:23:45 -0000	1.35
+++ sys/fs/pseudofs/pseudofs_vnops.c	22 May 2003 04:40:09 -0000
_at__at_ -411,7 +411,8 _at__at_
 		vn_lock(vn, LK_EXCLUSIVE|LK_RETRY, cnp->cn_thread);
 		cnp->cn_flags &= ~PDIRUNLOCK;
 	}
-	if (!lockparent || !(cnp->cn_flags & ISLASTCN))
+	if ((!lockparent || !(cnp->cn_flags & ISLASTCN)) &&
+	    !(cnp->cn_flags & ISDOTDOT))
 		VOP_UNLOCK(vn, 0, cnp->cn_thread);
 
 	/*
Received on Wed May 21 2003 - 21:21:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:08 UTC