Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jul 1998 14:58:11 -0700 (PDT)
From:      Julian Elischer <julian@whistle.com>
To:        current@FreeBSD.ORG
Subject:   small locking patch for discussion
Message-ID:  <Pine.BSF.3.95.980704145503.10069F-200000@current1.whistle.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
I have this litle patch sitting around.


I don't know if it does anything but could someone who
knows about the locking comment?

It was a "BTW" from terry and I'd like to either
commit it or throw it away, rather than have it 
sitting there looking at me.. 

julian


[-- Attachment #2 --]
Index: ufs/ufs/ufs_quota.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ufs/ufs_quota.c,v
retrieving revision 1.23
diff -c -r1.23 ufs_quota.c
*** ufs_quota.c	1998/06/21 14:53:40	1.23
--- ufs_quota.c	1998/07/04 20:39:16
***************
*** 465,478 ****
  	/*
  	 * Search vnodes associated with this mount point,
  	 * deleting any references to quota file being closed.
  	 */
  again:
  	for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nextvp) {
  		nextvp = vp->v_mntvnodes.le_next;
  		if (vp->v_type == VNON)
  			continue;
! 		if (vget(vp, LK_EXCLUSIVE, p))
  			goto again;
  		ip = VTOI(vp);
  		dq = ip->i_dquot[type];
  		ip->i_dquot[type] = NODQUOT;
--- 465,489 ----
  	/*
  	 * Search vnodes associated with this mount point,
  	 * deleting any references to quota file being closed.
+ 	 *
+ 	 * This is nearly identical to code in VFSOP_RELOAD, and
+ 	 * *must* be maintained in parallel!
  	 */
  again:
+ 	simple_lock(&mntvnode_slock);
  	for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nextvp) {
+ 		if (vp->v_mount != mp) {
+ 			simple_unlock(&mntvnode_slock);
+ 			goto again;
+ 		}
  		nextvp = vp->v_mntvnodes.le_next;
  		if (vp->v_type == VNON)
  			continue;
! 		simple_lock(&vp->v_interlock);
! 		simple_unlock(&mntvnode_slock);
! 		if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) {
  			goto again;
+ 		}
  		ip = VTOI(vp);
  		dq = ip->i_dquot[type];
  		ip->i_dquot[type] = NODQUOT;
***************
*** 480,485 ****
--- 491,497 ----
  		vput(vp);
  		if (vp->v_mntvnodes.le_next != nextvp || vp->v_mount != mp)
  			goto again;
+ 		simple_lock(&mntvnode_slock);
  	}
  	dqflush(qvp);
  	qvp->v_flag &= ~VSYSTEM;

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.980704145503.10069F-200000>