Re: acquiring duplicate lock of same type: "vnode interlock"

From: Jun Kuriyama <kuriyama_at_imgsrc.co.jp>
Date: Fri, 13 Feb 2004 08:34:48 +0900
At Fri, 13 Feb 2004 06:16:21 +1100 (EST),
Bruce Evans wrote:
> > _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;
> 
> (1) Nested declaration.
> (2) Initialization in declaration.
> (3) No blank line after declaration.

Thanks!  Is this better than I committed?


Index: ffs_snapshot.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_snapshot.c,v
retrieving revision 1.78
diff -u -r1.78 ffs_snapshot.c
--- ffs_snapshot.c	12 Feb 2004 08:52:08 -0000	1.78
+++ ffs_snapshot.c	12 Feb 2004 23:33:07 -0000
_at__at_ -488,7 +488,9 _at__at_
 	VI_LOCK(devvp);
 	snaphead = &devvp->v_rdev->si_snapshots;
 	if ((xp = TAILQ_FIRST(snaphead)) != NULL) {
-		struct lock *lkp = ITOV(xp)->v_vnlock;
+		struct lock *lkp;
+
+		lkp = ITOV(xp)->v_vnlock;
 		VI_UNLOCK(devvp);
 		VI_LOCK(vp);
 		vp->v_vnlock = lkp;
_at__at_ -1794,7 +1796,9 _at__at_
 		 */
 		VI_LOCK(devvp);
 		if ((xp = TAILQ_FIRST(snaphead)) != NULL) {
-			struct lock *lkp = ITOV(xp)->v_vnlock;
+			struct lock *lkp;
+
+			lkp = ITOV(xp)->v_vnlock;
 			VI_UNLOCK(devvp);
 			VI_LOCK(vp);
 			vp->v_vnlock = lkp;


-- 
Jun Kuriyama <kuriyama_at_imgsrc.co.jp> // IMG SRC, Inc.
             <kuriyama_at_FreeBSD.org> // FreeBSD Project
Received on Thu Feb 12 2004 - 14:34:51 UTC

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