NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/28448 (stackable filesystems locking breakage when looking up DOTDOT)



The following reply was made to PR kern/28448; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/28448 (stackable filesystems locking breakage when looking
 up DOTDOT)
Date: Wed, 14 Oct 2015 20:17:24 +0000

 On Sun, Jan 04, 2009 at 01:26:54AM +0000, dholland%NetBSD.org@localhost wrote:
  > Problem has been identified more clearly, and is definitely real.
 
 ok, update:
   (1) this is fixed in -current and -7, because VOP_LOOKUP no longer
       locks the result before returning it.
   (2) candidate patch for -6; this needs testing. (it's passed an
       anita run but that isn't by itself real persuasive)
 
 Index: sys/miscfs/genfs/layer_vnops.c
 ===================================================================
 RCS file: /cvsroot/src/sys/miscfs/genfs/layer_vnops.c,v
 retrieving revision 1.50.8.1
 diff -u -p -r1.50.8.1 layer_vnops.c
 --- sys/miscfs/genfs/layer_vnops.c	18 Nov 2012 18:36:58 -0000	1.50.8.1
 +++ sys/miscfs/genfs/layer_vnops.c	14 Oct 2015 20:14:42 -0000
 @@ -382,7 +382,21 @@ layer_lookup(void *v)
  		vref(dvp);
  		*ap->a_vpp = dvp;
  		vrele(lvp);
 -	} else if (lvp != NULL) {
 +	} else if (lvp == NULL) {
 +		/* nothing */
 +	} else if (cnp->cn_flags & ISDOTDOT) {
 +		/* must unlock dvp temporarily to conform to lock ordering */
 +		struct mount *mp;
 +
 +		/* mp can't disappear because we still hold a ref on dvp */
 +		mp = dvp->v_mount;
 +		VOP_UNLOCK(dvp);
 +		error = layer_node_create(mp, lvp, ap->a_vpp);
 +		vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
 +		if (error) {
 +			vrele(lvp);
 +		}
 +	} else {
  		/* Note: dvp, ldvp and lvp are all locked. */
  		error = layer_node_create(dvp->v_mount, lvp, ap->a_vpp);
  		if (error) {
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index