Windows: cm_ShutdownSCache corrections

Obtain cm_scache.dirlock, cm_scache.rw and cm_scacheLock
in the correct order.

Do not release cm_scache.rw when it is not held.

Since the cm_scacheLock is being dropped, preserve the value
of scp->allNextp prior to dropping the lock.

Change-Id: I025a8d76f3f7b94ae00bfd4e000750a90d38b343
Reviewed-on: http://gerrit.openafs.org/5279
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2011-08-15 00:34:00 -04:00 committed by Jeffrey Altman
parent 020b415be8
commit c58ae34f72

View File

@ -583,20 +583,24 @@ cm_SuspendSCache(void)
long long
cm_ShutdownSCache(void) cm_ShutdownSCache(void)
{ {
cm_scache_t * scp; cm_scache_t * scp, * nextp;
cm_GiveUpAllCallbacksAllServersMulti(FALSE); cm_GiveUpAllCallbacksAllServersMulti(FALSE);
lock_ObtainWrite(&cm_scacheLock); lock_ObtainWrite(&cm_scacheLock);
for ( scp = cm_data.allSCachesp; scp; for ( scp = cm_data.allSCachesp; scp;
scp = scp->allNextp ) { scp = nextp ) {
if (scp->randomACLp) { nextp = scp->allNextp;
lock_ReleaseWrite(&cm_scacheLock); lock_ReleaseWrite(&cm_scacheLock);
#ifdef USE_BPLUS
lock_ObtainWrite(&scp->dirlock);
#endif
lock_ObtainWrite(&scp->rw); lock_ObtainWrite(&scp->rw);
lock_ObtainWrite(&cm_scacheLock); lock_ObtainWrite(&cm_scacheLock);
if (scp->randomACLp) {
cm_FreeAllACLEnts(scp); cm_FreeAllACLEnts(scp);
lock_ReleaseWrite(&scp->rw);
} }
if (scp->cbServerp) { if (scp->cbServerp) {
@ -612,6 +616,7 @@ cm_ShutdownSCache(void)
freeBtree(scp->dirBplus); freeBtree(scp->dirBplus);
scp->dirBplus = NULL; scp->dirBplus = NULL;
scp->dirDataVersion = CM_SCACHE_VERSION_BAD; scp->dirDataVersion = CM_SCACHE_VERSION_BAD;
lock_ReleaseWrite(&scp->dirlock);
lock_FinalizeRWLock(&scp->dirlock); lock_FinalizeRWLock(&scp->dirlock);
#endif #endif
lock_FinalizeRWLock(&scp->rw); lock_FinalizeRWLock(&scp->rw);