From b7398a8a50522fe15f8a30dead6487b219c7b5f5 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 21 Jul 2008 21:55:06 +0000 Subject: [PATCH] windows-more-rxconnp-20080721 LICENSE MIT convert additional 'connp' instances to 'rxconnp' in cm_volume.c, make sure that we hold a reference to the rxconnp whenever we use it to perform an RPC. --- src/WINNT/afsd/cm_conn.c | 24 ++++++++++++------------ src/WINNT/afsd/cm_volume.c | 28 +++++++++++++++++++++------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 9b5fada..624ff13 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -829,8 +829,8 @@ long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp, hardTimeLeft = HardDeadtimeout; lock_ObtainMutex(&(*connpp)->mx); - rx_SetConnDeadTime((*connpp)->callp, timeLeft); - rx_SetConnHardDeadTime((*connpp)->callp, (u_short) hardTimeLeft); + rx_SetConnDeadTime((*connpp)->rxconnp, timeLeft); + rx_SetConnHardDeadTime((*connpp)->rxconnp, (u_short) hardTimeLeft); lock_ReleaseMutex(&(*connpp)->mx); #endif return 0; @@ -880,7 +880,7 @@ void cm_GCConnections(cm_server_t *serverp) cm_PutServer(tcp->serverp); cm_ReleaseUser(userp); *lcpp = tcp->nextp; - rx_DestroyConnection(tcp->callp); + rx_DestroyConnection(tcp->rxconnp); lock_FinalizeMutex(&tcp->mx); free(tcp); } @@ -926,14 +926,14 @@ static void cm_NewRXConnection(cm_conn_t *tcp, cm_ucell_t *ucellp, secObjp = rxnull_NewClientSecurityObject(); } osi_assertx(secObjp != NULL, "null rx_securityClass"); - tcp->callp = rx_NewConnection(serverp->addr.sin_addr.s_addr, + tcp->rxconnp = rx_NewConnection(serverp->addr.sin_addr.s_addr, port, serviceID, secObjp, secIndex); - rx_SetConnDeadTime(tcp->callp, ConnDeadtimeout); - rx_SetConnHardDeadTime(tcp->callp, HardDeadtimeout); - rx_SetConnIdleDeadTime(tcp->callp, IdleDeadtimeout); + rx_SetConnDeadTime(tcp->rxconnp, ConnDeadtimeout); + rx_SetConnHardDeadTime(tcp->rxconnp, HardDeadtimeout); + rx_SetConnIdleDeadTime(tcp->rxconnp, IdleDeadtimeout); tcp->ucgen = ucellp->gen; if (secObjp) rxs_Release(secObjp); /* Decrement the initial refCount */ @@ -998,7 +998,7 @@ long cm_ConnByServer(cm_server_t *serverp, cm_user_t *userp, cm_conn_t **connpp) else osi_Log0(afsd_logp, "cm_ConnByServer replace connection due to crypt change"); tcp->flags &= ~CM_CONN_FLAG_FORCE_NEW; - rx_DestroyConnection(tcp->callp); + rx_DestroyConnection(tcp->rxconnp); cm_NewRXConnection(tcp, ucellp, serverp); } lock_ReleaseMutex(&tcp->mx); @@ -1099,12 +1099,12 @@ long cm_ConnFromVolume(struct cm_volume *volp, unsigned long volid, struct cm_us extern struct rx_connection * cm_GetRxConn(cm_conn_t *connp) { - struct rx_connection * rxconn; + struct rx_connection * rxconnp; lock_ObtainMutex(&connp->mx); - rxconn = connp->callp; - rx_GetConnection(rxconn); + rxconnp = connp->rxconnp; + rx_GetConnection(rxconnp); lock_ReleaseMutex(&connp->mx); - return rxconn; + return rxconnp; } void cm_ForceNewConnections(cm_server_t *serverp) diff --git a/src/WINNT/afsd/cm_volume.c b/src/WINNT/afsd/cm_volume.c index 81f0323..3dffceb 100644 --- a/src/WINNT/afsd/cm_volume.c +++ b/src/WINNT/afsd/cm_volume.c @@ -227,22 +227,27 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * /* now we have volume structure locked and held; make RPC to fill it */ osi_Log2(afsd_logp, "CALL VL_GetEntryByName{UNO} name %s:%s", volp->cellp->name, volp->namep); do { + struct rx_connection * rxconnp; + code = cm_ConnByMServers(cellp->vlServersp, userp, reqp, &connp); if (code) continue; + + rxconnp = cm_GetRxConn(connp); #ifdef MULTIHOMED - code = VL_GetEntryByNameU(connp->callp, volp->namep, &uvldbEntry); + code = VL_GetEntryByNameU(rxconnp, volp->namep, &uvldbEntry); method = 2; if ( code == RXGEN_OPCODE ) #endif { - code = VL_GetEntryByNameN(connp->callp, volp->namep, &nvldbEntry); + code = VL_GetEntryByNameN(rxconnp, volp->namep, &nvldbEntry); method = 1; } if ( code == RXGEN_OPCODE ) { - code = VL_GetEntryByNameO(connp->callp, volp->namep, &vldbEntry); + code = VL_GetEntryByNameO(rxconnp, volp->namep, &vldbEntry); method = 0; } + rx_PutConnection(rxconnp); } while (cm_Analyze(connp, userp, reqp, NULL, NULL, cellp->vlServersp, NULL, code)); code = cm_MapVLRPCError(code, reqp); if ( code ) @@ -267,22 +272,27 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * osi_Log2(afsd_logp, "CALL VL_GetEntryByName{UNO} name %s:%s", volp->cellp->name, osi_LogSaveString(afsd_logp,name)); do { + struct rx_connection * rxconnp; + code = cm_ConnByMServers(cellp->vlServersp, userp, reqp, &connp); if (code) continue; + + rxconnp = cm_GetRxConn(connp); #ifdef MULTIHOMED - code = VL_GetEntryByNameU(connp->callp, name, &uvldbEntry); + code = VL_GetEntryByNameU(connp->rxconnp, name, &uvldbEntry); method = 2; if ( code == RXGEN_OPCODE ) #endif { - code = VL_GetEntryByNameN(connp->callp, name, &nvldbEntry); + code = VL_GetEntryByNameN(connp->rxconnp, name, &nvldbEntry); method = 1; } if ( code == RXGEN_OPCODE ) { - code = VL_GetEntryByNameO(connp->callp, name, &vldbEntry); + code = VL_GetEntryByNameO(connp->rxconnp, name, &vldbEntry); method = 0; } + rx_PutConnection(rxconnp); } while (cm_Analyze(connp, userp, reqp, NULL, NULL, cellp->vlServersp, NULL, code)); code = cm_MapVLRPCError(code, reqp); if ( code ) @@ -364,11 +374,15 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t * memset((char *)&addrs, 0, sizeof(addrs)); do { + struct rx_connection *rxconnp; + code = cm_ConnByMServers(cellp->vlServersp, userp, reqp, &connp); if (code) continue; - code = VL_GetAddrsU(connp->callp, &attrs, &uuid, &unique, &nentries, &addrs); + rxconnp = cm_GetRxConn(connp); + code = VL_GetAddrsU(rxconnp, &attrs, &uuid, &unique, &nentries, &addrs); + rx_PutConnection(rxconnp); } while (cm_Analyze(connp, userp, reqp, NULL, NULL, cellp->vlServersp, NULL, code)); if ( code ) { -- 1.9.4