diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 0985ace4d3..43b9f5cd03 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -459,17 +459,19 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, break; } - /* Log server being offline for this volume */ - sprintf(addr, "%d.%d.%d.%d", - ((serverp->addr.sin_addr.s_addr & 0xff)), - ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8), - ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), - ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); + if (serverp && fidp) { + /* Log server being offline for this volume */ + sprintf(addr, "%d.%d.%d.%d", + ((serverp->addr.sin_addr.s_addr & 0xff)), + ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8), + ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), + ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); - osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume); + osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume); #ifndef DJGPP - LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume); + LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume); #endif + } /* Mark server offline for this volume */ if (!serversp && fidp) { @@ -479,6 +481,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, free_svr_list = 1; } } + lock_ObtainWrite(&cm_serverLock); for (tsrp = serversp; tsrp; tsrp=tsrp->next) { if (tsrp->server == serverp) { @@ -538,6 +541,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, lock_ObtainWrite(&cm_scacheLock); cm_RemoveSCacheFromHashTable(scp); lock_ReleaseWrite(&cm_scacheLock); + cm_LockMarkSCacheLost(scp); scp->flags |= CM_SCACHEFLAG_DELETED; lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index 9b44b808ec..bea15dfbef 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -3959,9 +3959,6 @@ long cm_LockCheckWrite(cm_scache_t *scp, #endif } -/* Forward dcl. */ -static void cm_LockMarkSCacheLost(cm_scache_t * scp); - /* Called with cm_scacheLock write locked */ static cm_file_lock_t * cm_GetFileLock(void) { cm_file_lock_t * l; @@ -4907,7 +4904,7 @@ long cm_Unlock(cm_scache_t *scp, } /* called with scp->mx held */ -static void cm_LockMarkSCacheLost(cm_scache_t * scp) +void cm_LockMarkSCacheLost(cm_scache_t * scp) { cm_file_lock_t *fileLock; osi_queue_t *q; @@ -5031,7 +5028,7 @@ void cm_CheckLocks() if (!IS_LOCK_ACTIVE(fileLock)) goto pre_syncopdone; - if (scp->serverLock != -1) { + if (scp->serverLock != -1 && !(scp->flags & CM_SCACHEFLAG_DELETED)) { cm_fid_t cfid; cm_user_t * userp; @@ -5108,7 +5105,8 @@ void cm_CheckLocks() } } - if (code == EINVAL || code == CM_ERROR_INVAL) { + if (code == EINVAL || code == CM_ERROR_INVAL || + code == CM_ERROR_BADFD) { cm_LockMarkSCacheLost(scp); } diff --git a/src/WINNT/afsd/cm_vnodeops.h b/src/WINNT/afsd/cm_vnodeops.h index b376efdaaf..91b616dc9c 100644 --- a/src/WINNT/afsd/cm_vnodeops.h +++ b/src/WINNT/afsd/cm_vnodeops.h @@ -224,6 +224,8 @@ extern void cm_CheckLocks(void); extern void cm_ReleaseAllLocks(void); +extern void cm_LockMarkSCacheLost(cm_scache_t * scp); + extern long cm_RetryLock(cm_file_lock_t *oldFileLock, int client_is_dead); #define CM_SESSION_SMB 0xffff