else {
/* file server */
code = RXAFS_GetCapabilities(rxconnp, &caps);
- if (code == RXGEN_OPCODE)
- code = RXAFS_GetTime(rxconnp, &secs, &usecs);
}
if (wasDown)
rx_SetConnDeadTime(rxconnp, ConnDeadtimeout);
} /* 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;
/* Process results of servers that support RXAFS_GetCapabilities */
for (i=0; i<nconns; i++) {
- /* Leave the servers that did not support GetCapabilities alone */
- if (results[i] == RXGEN_OPCODE)
- continue;
-
if (conntimer[i])
rx_SetConnDeadTime(rxconns[i], ConnDeadtimeout);
rx_PutConnection(rxconns[i]);
lock_ObtainMutex(&tsp->mx);
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;
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; i<nconns; i++) {
- if (results[i] == RXGEN_OPCODE) {
- if (i != j) {
- conns[j] = conns[i];
- rxconns[j] = rxconns[i];
- serversp[j] = serversp[i];
- }
- j++;
- }
- }
- nconns = j;
-
- if (nconns) {
- /* Perform the multi call */
- start = time(NULL);
- multi_Rx(rxconns,nconns)
- {
- secs = usecs = 0;
- multi_RXAFS_GetTime(&secs, &usecs);
- end = time(NULL);
- results[multi_i]=multi_error;
- if ((start == end) && !multi_error)
- deltas[multi_i] = end - secs;
- } multi_End;
- }
-
- /* Process Results of servers that only support RXAFS_GetTime */
- for (i=0; i<nconns; i++) {
- /* Leave the servers that did not support GetCapabilities alone */
- if (conntimer[i])
- rx_SetConnDeadTime(rxconns[i], ConnDeadtimeout);
- rx_PutConnection(rxconns[i]);
- cm_PutConn(conns[i]);
-
- tsp = serversp[i];
- cm_GCConnections(tsp);
-
- lock_ObtainMutex(&tsp->mx);
- 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; i<NUM_SERVER_VOLS; i++) {
- if (tsrvp->ids[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; i<NUM_SERVER_VOLS; i++) {
- if (tsrvp->ids[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) ||