From: Jeffrey Hutzelman Date: Mon, 21 Jan 2008 17:37:30 +0000 (+0000) Subject: DEVEL15-solaris-vfsroot-refcount-issue-20080121 X-Git-Tag: openafs-devel-1_5_31~82 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=5d37c040b04c5caac78fc89264576717c5ab4836;p=packages%2Fo%2Fopenafs.git DEVEL15-solaris-vfsroot-refcount-issue-20080121 LICENSE IPL10 fix issue with afs root vnode refcount dropping to 0 (cherry picked from commit fc91cf4314eb768a2f83f198645e553b5fa778de) --- diff --git a/src/afs/SOLARIS/osi_vfsops.c b/src/afs/SOLARIS/osi_vfsops.c index 482e210c3..b44ecd349 100644 --- a/src/afs/SOLARIS/osi_vfsops.c +++ b/src/afs/SOLARIS/osi_vfsops.c @@ -103,6 +103,7 @@ afs_root(struct vfs *afsp, struct vnode **avpp) register afs_int32 code = 0; struct vrequest treq; register struct vcache *tvp = 0; + struct vcache *gvp; struct proc *proc = ttoproc(curthread); struct vnode *vp = afsp->vfs_vnodecovered; int locked = 0; @@ -118,6 +119,7 @@ afs_root(struct vfs *afsp, struct vnode **avpp) AFS_STATCNT(afs_root); +again: if (afs_globalVp && (afs_globalVp->states & CStatd)) { tvp = afs_globalVp; } else { @@ -128,8 +130,9 @@ afs_root(struct vfs *afsp, struct vnode **avpp) } if (afs_globalVp) { - afs_PutVCache(afs_globalVp); + gvp = afs_globalVp; afs_globalVp = NULL; + afs_PutVCache(gvp); } if (!(code = afs_InitReq(&treq, proc->p_cred)) @@ -137,6 +140,12 @@ afs_root(struct vfs *afsp, struct vnode **avpp) tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL); /* we really want this to stay around */ if (tvp) { + if (afs_globalVp) { + /* someone else got there before us! */ + afs_PutVCache(tvp); + tvp = 0; + goto again; + } afs_globalVp = tvp; } else code = ENOENT;