acquiring duplicate lock of same type: "vnode interlock"

From: Jun Kuriyama <kuriyama_at_imgsrc.co.jp>
Date: Thu, 12 Feb 2004 10:15:07 +0900
Is this patch safe for locking?  This may remove warnings below:

acquiring duplicate lock of same type: "vnode interlock"
 1st vnode interlock _at_ ufs/ffs/ffs_snapshot.c:488
 2nd vnode interlock _at_ ufs/ffs/ffs_snapshot.c:491


Index: ffs_snapshot.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_snapshot.c,v
retrieving revision 1.77
diff -u -r1.77 ffs_snapshot.c
--- ffs_snapshot.c	4 Jan 2004 04:08:34 -0000	1.77
+++ ffs_snapshot.c	12 Feb 2004 01:08:31 -0000
_at__at_ -488,9 +488,10 _at__at_
 	VI_LOCK(devvp);
 	snaphead = &devvp->v_rdev->si_snapshots;
 	if ((xp = TAILQ_FIRST(snaphead)) != NULL) {
-		VI_LOCK(vp);
-		vp->v_vnlock = ITOV(xp)->v_vnlock;
+		struct lock *lkp = ITOV(xp)->v_vnlock;
 		VI_UNLOCK(devvp);
+		VI_LOCK(vp);
+		vp->v_vnlock = lkp;
 	} else {
 		struct lock *lkp;
 
_at__at_ -1793,9 +1794,10 _at__at_
 		 */
 		VI_LOCK(devvp);
 		if ((xp = TAILQ_FIRST(snaphead)) != NULL) {
-			VI_LOCK(vp);
-			vp->v_vnlock = ITOV(xp)->v_vnlock;
+			struct lock *lkp = ITOV(xp)->v_vnlock;
 			VI_UNLOCK(devvp);
+			VI_LOCK(vp);
+			vp->v_vnlock = lkp;
 		} else {
 			struct lock *lkp;
 


-- 
Jun Kuriyama <kuriyama_at_imgsrc.co.jp> // IMG SRC, Inc.
             <kuriyama_at_FreeBSD.org> // FreeBSD Project
Received on Wed Feb 11 2004 - 16:15:12 UTC

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