From 2beda68d4ad84e3e853a320bfb9d610b33f77902 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 18 Apr 2010 12:38:27 +0100 Subject: [PATCH] Windows: prevent infinite idle error response The idle error value (if any) is stored in the cm_req_t object. Since the value is never cleared, the same value can be returned for all requests that make use of the same cm_req_t object. Change the behavior to only return an idle error once and then clear it. LICENSE MIT Change-Id: Iac9ff8e56e856c2f0e440a34ac39ccd68de37c77 Reviewed-on: http://gerrit.openafs.org/1773 Reviewed-by: Asanka Herath Tested-by: Asanka Herath Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_conn.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 4cefe7f73..065d30b69 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -1056,14 +1056,21 @@ long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp, lock_ReleaseRead(&cm_serverLock); if (firstError == 0) { - if (allDown) + if (allDown) { firstError = (reqp->tokenError ? reqp->tokenError : (reqp->idleError ? RX_CALL_TIMEOUT : CM_ERROR_ALLDOWN)); - else if (allBusy) + /* + * if we experienced either a token error or and idle dead time error + * and now all of the servers are down, we have either tried them + * all or lost connectivity. Clear the error we are returning so + * we will not return it indefinitely if the request is retried. + */ + reqp->idleError = reqp->tokenError = 0; + } else if (allBusy) { firstError = CM_ERROR_ALLBUSY; - else if (allOffline || (someBusy && someOffline)) + } else if (allOffline || (someBusy && someOffline)) { firstError = CM_ERROR_ALLOFFLINE; - else { + } else { osi_Log0(afsd_logp, "cm_ConnByMServers returning impossible error TIMEDOUT"); firstError = CM_ERROR_TIMEDOUT; } -- 2.39.5