From 166de9ffa29244f38f1d2c1e8b0fa9a9fd1802b5 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 1 Dec 2010 18:47:29 -0500 Subject: [PATCH] Windows: Remove fallback from GetCaps to GetTime If the file server responds to RXAFS_GetCapabilities with RXGEN_OPCODE the server is up and there is no need to fallback to RXAFS_GetTime. Remove the code that performs the extra work. Change-Id: Ieb0d1cce6f356a8988f2464227dec9b6cd9e6fcf Reviewed-on: http://gerrit.openafs.org/3419 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_server.c | 145 ++------------------------------------------- 1 file changed, 4 insertions(+), 141 deletions(-) diff --git a/src/WINNT/afsd/cm_server.c b/src/WINNT/afsd/cm_server.c index e9751e1..32a5132 100644 --- a/src/WINNT/afsd/cm_server.c +++ b/src/WINNT/afsd/cm_server.c @@ -166,8 +166,6 @@ cm_PingServer(cm_server_t *tsp) else { /* file server */ code = RXAFS_GetCapabilities(rxconnp, &caps); - if (code == RXGEN_OPCODE) - code = RXAFS_GetTime(rxconnp, &secs, &usecs); } if (wasDown) rx_SetConnDeadTime(rxconnp, ConnDeadtimeout); @@ -176,13 +174,13 @@ cm_PingServer(cm_server_t *tsp) } /* got an unauthenticated connection to this server */ lock_ObtainMutex(&tsp->mx); - if (code >= 0) { + if (code >= 0 || code == RXGEN_OPCODE) { /* mark server as up */ tsp->flags &= ~CM_SERVERFLAG_DOWN; tsp->downTime = 0; /* we currently handle 32-bits of capabilities */ - if (caps.Capabilities_len > 0) { + if (code != RXGEN_OPCODE && caps.Capabilities_len > 0) { tsp->capabilities = caps.Capabilities_val[0]; xdr_free((xdrproc_t) xdr_Capabilities, &caps); caps.Capabilities_len = 0; @@ -450,10 +448,6 @@ static void cm_CheckServersMulti(afs_uint32 flags, cm_cell_t *cellp) /* Process results of servers that support RXAFS_GetCapabilities */ for (i=0; imx); wasDown = tsp->flags & CM_SERVERFLAG_DOWN; - if (results[i] >= 0) { + if (results[i] >= 0 || results[i] == RXGEN_OPCODE) { /* mark server as up */ tsp->flags &= ~CM_SERVERFLAG_DOWN; tsp->downTime = 0; /* we currently handle 32-bits of capabilities */ - if (caps[i].Capabilities_len > 0) { + if (results[i] != RXGEN_OPCODE && caps[i].Capabilities_len > 0) { tsp->capabilities = caps[i].Capabilities_val[0]; xdr_free((xdrproc_t) xdr_Capabilities, &caps[i]); caps[i].Capabilities_len = 0; @@ -560,137 +554,6 @@ static void cm_CheckServersMulti(afs_uint32 flags, cm_cell_t *cellp) cm_PutServer(tsp); } - - /* - * At this point we have handled any responses that did not indicate - * that RXAFS_GetCapabilities is not supported. - */ - for ( i=0, j=0; imx); - wasDown = tsp->flags & CM_SERVERFLAG_DOWN; - - if (results[i] >= 0) { - /* mark server as up */ - tsp->flags &= ~CM_SERVERFLAG_DOWN; - tsp->downTime = 0; - tsp->capabilities = 0; - - afs_inet_ntoa_r(tsp->addr.sin_addr.S_un.S_addr, hoststr); - osi_Log3(afsd_logp, "cm_MultiPingServer server %s (%s) is up with caps 0x%x", - osi_LogSaveString(afsd_logp, hoststr), - tsp->type == CM_SERVER_VLDB ? "vldb" : "file", - tsp->capabilities); - - /* Now update the volume status if necessary */ - if (wasDown) { - cm_server_vols_t * tsrvp; - cm_volume_t * volp; - int i; - - for (tsrvp = tsp->vols; tsrvp; tsrvp = tsrvp->nextp) { - for (i=0; iids[i] != 0) { - cm_InitReq(&req); - - lock_ReleaseMutex(&tsp->mx); - code = cm_FindVolumeByID(tsp->cellp, tsrvp->ids[i], cm_rootUserp, - &req, CM_GETVOL_FLAG_NO_LRU_UPDATE, &volp); - lock_ObtainMutex(&tsp->mx); - if (code == 0) { - cm_UpdateVolumeStatus(volp, tsrvp->ids[i]); - cm_PutVolume(volp); - } - } - } - } - } - } else { - /* mark server as down */ - if (!(tsp->flags & CM_SERVERFLAG_DOWN)) { - tsp->flags |= CM_SERVERFLAG_DOWN; - tsp->downTime = time(NULL); - } - if (code != VRESTARTING) { - lock_ReleaseMutex(&tsp->mx); - cm_ForceNewConnections(tsp); - lock_ObtainMutex(&tsp->mx); - } - afs_inet_ntoa_r(tsp->addr.sin_addr.S_un.S_addr, hoststr); - osi_Log3(afsd_logp, "cm_MultiPingServer server %s (%s) is down with caps 0x%x", - osi_LogSaveString(afsd_logp, hoststr), - tsp->type == CM_SERVER_VLDB ? "vldb" : "file", - tsp->capabilities); - - /* Now update the volume status if necessary */ - if (!wasDown) { - cm_server_vols_t * tsrvp; - cm_volume_t * volp; - int i; - - for (tsrvp = tsp->vols; tsrvp; tsrvp = tsrvp->nextp) { - for (i=0; iids[i] != 0) { - cm_InitReq(&req); - - lock_ReleaseMutex(&tsp->mx); - code = cm_FindVolumeByID(tsp->cellp, tsrvp->ids[i], cm_rootUserp, - &req, CM_GETVOL_FLAG_NO_LRU_UPDATE, &volp); - lock_ObtainMutex(&tsp->mx); - if (code == 0) { - cm_UpdateVolumeStatus(volp, tsrvp->ids[i]); - cm_PutVolume(volp); - } - } - } - } - } - } - - if (tsp->waitCount == 0) - tsp->flags &= ~CM_SERVERFLAG_PINGING; - else - osi_Wakeup((LONG_PTR)tsp); - - lock_ReleaseMutex(&tsp->mx); - - cm_PutServer(tsp); - } } if ((flags & CM_FLAG_CHECKVLDBSERVERS) || -- 1.9.4