vnrehash-avoid-cachecheck-change-20050618

unlocking and locking lets us race and makes cacheCheck potentially go bad
This commit is contained in:
Derrick Brashear 2005-07-19 15:44:53 +00:00
parent fb1b339a01
commit ea20d8d6c2

View File

@ -321,6 +321,7 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type)
return NULL;
vnodeNumber = bitNumberToVnodeNumber(bitNumber, class);
vnrehash:
VNLog(2, 1, vnodeNumber);
/* Prepare to move it to the new hash chain */
newHash = VNODE_HASH(vp, vnodeNumber);
@ -349,6 +350,10 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type)
VOL_UNLOCK;
ObtainWriteLock(&vnp->lock);
VOL_LOCK;
if (vnp->volumePtr->cacheCheck != vnp->cacheCheck) {
ReleaseWriteLock(&vnp->lock);
goto vnrehash;
}
}
#ifdef AFS_PTHREAD_ENV
vnp->writer = pthread_self();