From fc91cf4314eb768a2f83f198645e553b5fa778de Mon Sep 17 00:00:00 2001 From: Jeffrey Hutzelman Date: Mon, 21 Jan 2008 17:34:00 +0000 Subject: [PATCH] solaris-vfsroot-refcount-issue-20080121 LICENSE IPL10 fix issue with afs root vnode refcount dropping to 0 --- src/afs/SOLARIS/osi_vfsops.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; -- 2.39.5