From: Andrew Deason Date: Thu, 5 May 2011 16:18:08 +0000 (-0500) Subject: libafs: Get rx conn ref with afs conn ref X-Git-Tag: upstream/1.8.0_pre1^2~3763 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=03f0c656c1734b9be4debdf19b8f10771ff4420a;p=packages%2Fo%2Fopenafs.git libafs: Get rx conn ref with afs conn ref When we get a reference to an afs_conn with afs_Conn and its variants, we assume we can use the tc->id rx connection without holding any locks. However, if tc->forceConnectFS gets set, the tc->id connection can be destroyed and recreated out from under us. So, to avoid using a possibly freed rx connection, grab a reference to the rx connection at the same time as we grab a reference to the afs conn. And also put back the same reference with afs_PutConn. Change-Id: I442886ee89c6f3fa609e47261317e647e124eecc Reviewed-on: http://gerrit.openafs.org/4625 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afs/VNOPS/afs_vnop_create.c b/src/afs/VNOPS/afs_vnop_create.c index 3e91a748c..5fe491a99 100644 --- a/src/afs/VNOPS/afs_vnop_create.c +++ b/src/afs/VNOPS/afs_vnop_create.c @@ -56,6 +56,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, struct vcache *tvc; struct volume *volp = 0; struct afs_fakestat_state fakestate; + struct rx_connection *rxconn; XSTATS_DECLS; OSI_VC_CONVERT(adp); @@ -297,14 +298,14 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, InStatus.UnixModeBits = attrs->va_mode & 0xffff; /* only care about protection bits */ do { - tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn); if (tc) { hostp = tc->parent->srvr->server; /* remember for callback processing */ now = osi_Time(); XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_CREATEFILE); RX_AFS_GUNLOCK(); code = - RXAFS_CreateFile(tc->id, (struct AFSFid *)&adp->f.fid.Fid, + RXAFS_CreateFile(rxconn, (struct AFSFid *)&adp->f.fid.Fid, aname, &InStatus, (struct AFSFid *) &newFid.Fid, &OutFidStatus, &OutDirStatus, &CallBack, &tsync); @@ -314,7 +315,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else code = -1; } while (afs_Analyze - (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_CREATEFILE, + (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_CREATEFILE, SHARED_LOCK, NULL)); if ((code == EEXIST || code == UAEEXIST) && diff --git a/src/afs/VNOPS/afs_vnop_dirops.c b/src/afs/VNOPS/afs_vnop_dirops.c index 4e5140f35..f4e4e4565 100644 --- a/src/afs/VNOPS/afs_vnop_dirops.c +++ b/src/afs/VNOPS/afs_vnop_dirops.c @@ -40,6 +40,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, struct vrequest treq; afs_int32 code; struct afs_conn *tc; + struct rx_connection *rxconn; struct VenusFid newFid; struct dcache *tdc; struct dcache *new_dc; @@ -103,13 +104,13 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, if (!AFS_IS_DISCON_RW) { do { - tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_MAKEDIR); now = osi_Time(); RX_AFS_GUNLOCK(); code = - RXAFS_MakeDir(tc->id, + RXAFS_MakeDir(rxconn, (struct AFSFid *)&adp->f.fid.Fid, aname, &InStatus, @@ -125,7 +126,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else code = -1; } while (afs_Analyze - (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_MAKEDIR, + (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_MAKEDIR, SHARED_LOCK, NULL)); if (code) { @@ -263,6 +264,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred) struct AFSFetchStatus OutDirStatus; struct AFSVolSync tsync; struct afs_fakestat_state fakestate; + struct rx_connection *rxconn; XSTATS_DECLS; OSI_VC_CONVERT(adp); @@ -332,12 +334,12 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred) if (!AFS_IS_DISCON_RW) { /* Not disconnected, can connect to server. */ do { - tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEDIR); RX_AFS_GUNLOCK(); code = - RXAFS_RemoveDir(tc->id, + RXAFS_RemoveDir(rxconn, (struct AFSFid *)&adp->f.fid.Fid, aname, &OutDirStatus, @@ -347,7 +349,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred) } else code = -1; } while (afs_Analyze - (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_REMOVEDIR, + (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_REMOVEDIR, SHARED_LOCK, NULL)); if (code) { diff --git a/src/afs/VNOPS/afs_vnop_flock.c b/src/afs/VNOPS/afs_vnop_flock.c index 013c5dc29..5b91a5765 100644 --- a/src/afs/VNOPS/afs_vnop_flock.c +++ b/src/afs/VNOPS/afs_vnop_flock.c @@ -334,19 +334,20 @@ HandleFlock(struct vcache *avc, int acom, struct vrequest *areq, } if (avc->flockCount == 0) { if (!AFS_IS_DISCONNECTED) { + struct rx_connection *rxconn; do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RELEASELOCK); RX_AFS_GUNLOCK(); - code = RXAFS_ReleaseLock(tc->id, (struct AFSFid *) + code = RXAFS_ReleaseLock(rxconn, (struct AFSFid *) &avc->f.fid.Fid, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_RELEASELOCK, SHARED_LOCK, NULL)); } else { /*printf("Network is dooooooowwwwwwwnnnnnnn\n");*/ @@ -392,14 +393,15 @@ HandleFlock(struct vcache *avc, int acom, struct vrequest *areq, } if (!code && avc->flockCount == 0) { if (!AFS_IS_DISCONNECTED) { + struct rx_connection *rxconn; do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME (AFS_STATS_FS_RPCIDX_RELEASELOCK); RX_AFS_GUNLOCK(); code = - RXAFS_ReleaseLock(tc->id, + RXAFS_ReleaseLock(rxconn, (struct AFSFid *)&avc-> f.fid.Fid, &tsync); RX_AFS_GLOCK(); @@ -407,7 +409,7 @@ HandleFlock(struct vcache *avc, int acom, struct vrequest *areq, } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_RELEASELOCK, SHARED_LOCK, NULL)); } @@ -430,15 +432,16 @@ HandleFlock(struct vcache *avc, int acom, struct vrequest *areq, * we've already checked for compatibility), we shouldn't send * the call through to the server again */ if (avc->flockCount == 0) { + struct rx_connection *rxconn; /* we're the first on our block, send the call through */ lockType = ((acom & LOCK_EX) ? LockWrite : LockRead); if (!AFS_IS_DISCONNECTED) { do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SETLOCK); RX_AFS_GUNLOCK(); - code = RXAFS_SetLock(tc->id, (struct AFSFid *) + code = RXAFS_SetLock(rxconn, (struct AFSFid *) &avc->f.fid.Fid, lockType, &tsync); RX_AFS_GLOCK(); @@ -446,7 +449,7 @@ HandleFlock(struct vcache *avc, int acom, struct vrequest *areq, } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_SETLOCK, SHARED_LOCK, NULL)); if ((lockType == LockWrite) && (code == VREADONLY)) @@ -858,6 +861,7 @@ GetFlockCount(struct vcache *avc, struct vrequest *areq) struct AFSFetchStatus OutStatus; struct AFSCallBack CallBack; struct AFSVolSync tsync; + struct rx_connection *rxconn; int temp; XSTATS_DECLS; temp = areq->flags & O_NONBLOCK; @@ -868,19 +872,19 @@ GetFlockCount(struct vcache *avc, struct vrequest *areq) return 0; do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHSTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_FetchStatus(tc->id, (struct AFSFid *)&avc->f.fid.Fid, + RXAFS_FetchStatus(rxconn, (struct AFSFid *)&avc->f.fid.Fid, &OutStatus, &CallBack, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHSTATUS, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHSTATUS, SHARED_LOCK, NULL)); if (temp) diff --git a/src/afs/VNOPS/afs_vnop_link.c b/src/afs/VNOPS/afs_vnop_link.c index 50b69a973..26b6c71a2 100644 --- a/src/afs/VNOPS/afs_vnop_link.c +++ b/src/afs/VNOPS/afs_vnop_link.c @@ -46,6 +46,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, struct AFSFetchStatus OutFidStatus, OutDirStatus; struct AFSVolSync tsync; struct afs_fakestat_state vfakestate, dfakestate; + struct rx_connection *rxconn; XSTATS_DECLS; OSI_VC_CONVERT(adp); @@ -97,12 +98,12 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); /* test for error below */ ObtainWriteLock(&adp->lock, 145); do { - tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_LINK); RX_AFS_GUNLOCK(); code = - RXAFS_Link(tc->id, (struct AFSFid *)&adp->f.fid.Fid, aname, + RXAFS_Link(rxconn, (struct AFSFid *)&adp->f.fid.Fid, aname, (struct AFSFid *)&avc->f.fid.Fid, &OutFidStatus, &OutDirStatus, &tsync); RX_AFS_GLOCK(); @@ -111,7 +112,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname, } else code = -1; } while (afs_Analyze - (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_LINK, + (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_LINK, SHARED_LOCK, NULL)); if (code) { diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 127d00291..a36c70f01 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -683,6 +683,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) struct VenusFid dotdot = {0, {0, 0, 0}}; int flagIndex = 0; /* First file with bulk fetch flag set */ int inlinebulk = 0; /* Did we use InlineBulk RPC or not? */ + struct rx_connection *rxconn; XSTATS_DECLS; dotdot.Cell = 0; dotdot.Fid.Unique = 0; @@ -926,7 +927,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) /* start the timer; callback expirations are relative to this */ startTime = osi_Time(); - tcp = afs_Conn(&adp->f.fid, areqp, SHARED_LOCK); + tcp = afs_Conn(&adp->f.fid, areqp, SHARED_LOCK, &rxconn); if (tcp) { hostp = tcp->parent->srvr->server; @@ -965,7 +966,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) retryonce: RX_AFS_GUNLOCK(); code = - RXAFS_InlineBulkStatus(tcp->id, &fidParm, &statParm, + RXAFS_InlineBulkStatus(rxconn, &fidParm, &statParm, &cbParm, &volSync); RX_AFS_GLOCK(); if (code == RXGEN_OPCODE) { @@ -973,7 +974,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) inlinebulk = 0; RX_AFS_GUNLOCK(); code = - RXAFS_BulkStatus(tcp->id, &fidParm, &statParm, + RXAFS_BulkStatus(rxconn, &fidParm, &statParm, &cbParm, &volSync); RX_AFS_GLOCK(); } else { @@ -984,7 +985,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) * Retryable errors are all whole-volume or * whole-server. */ - if (afs_Analyze(tcp, (&statsp[0])->errorCode, + if (afs_Analyze(tcp, rxconn, (&statsp[0])->errorCode, &adp->f.fid, areqp, AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL) != 0) @@ -995,7 +996,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) inlinebulk = 0; RX_AFS_GUNLOCK(); code = - RXAFS_BulkStatus(tcp->id, &fidParm, &statParm, &cbParm, + RXAFS_BulkStatus(rxconn, &fidParm, &statParm, &cbParm, &volSync); RX_AFS_GLOCK(); } @@ -1003,7 +1004,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) } else code = -1; } while (afs_Analyze - (tcp, code, &adp->f.fid, areqp, AFS_STATS_FS_RPCIDX_BULKSTATUS, + (tcp, rxconn, code, &adp->f.fid, areqp, AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL)); /* now, if we didnt get the info, bail out. */ @@ -1305,7 +1306,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) /* If we did the InlineBulk RPC pull out the return code */ if (inlinebulk && code == 0) { if ((&statsp[0])->errorCode) { - afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->f.fid, areqp, + afs_Analyze(tcp, rxconn, (&statsp[0])->errorCode, &adp->f.fid, areqp, AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL); code = (&statsp[0])->errorCode; } diff --git a/src/afs/VNOPS/afs_vnop_remove.c b/src/afs/VNOPS/afs_vnop_remove.c index 7b679b361..d904bbe9f 100644 --- a/src/afs/VNOPS/afs_vnop_remove.c +++ b/src/afs/VNOPS/afs_vnop_remove.c @@ -61,22 +61,23 @@ afsremove(struct vcache *adp, struct dcache *tdc, struct afs_conn *tc; struct AFSFetchStatus OutDirStatus; struct AFSVolSync tsync; + struct rx_connection *rxconn; XSTATS_DECLS; if (!AFS_IS_DISCONNECTED) { do { - tc = afs_Conn(&adp->f.fid, treqp, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, treqp, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEFILE); RX_AFS_GUNLOCK(); code = - RXAFS_RemoveFile(tc->id, (struct AFSFid *)&adp->f.fid.Fid, + RXAFS_RemoveFile(rxconn, (struct AFSFid *)&adp->f.fid.Fid, aname, &OutDirStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &adp->f.fid, treqp, AFS_STATS_FS_RPCIDX_REMOVEFILE, + (tc, rxconn, code, &adp->f.fid, treqp, AFS_STATS_FS_RPCIDX_REMOVEFILE, SHARED_LOCK, NULL)); } diff --git a/src/afs/VNOPS/afs_vnop_rename.c b/src/afs/VNOPS/afs_vnop_rename.c index 45aaefa22..72c3598ad 100644 --- a/src/afs/VNOPS/afs_vnop_rename.c +++ b/src/afs/VNOPS/afs_vnop_rename.c @@ -44,6 +44,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, struct dcache *tdc1, *tdc2; struct AFSFetchStatus OutOldDirStatus, OutNewDirStatus; struct AFSVolSync tsync; + struct rx_connection *rxconn; XSTATS_DECLS; AFS_STATCNT(afs_rename); afs_Trace4(afs_iclSetp, CM_TRACE_RENAME, ICL_TYPE_POINTER, aodp, @@ -168,12 +169,12 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, if (!AFS_IS_DISCON_RW) { /* Connected. */ do { - tc = afs_Conn(&aodp->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&aodp->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RENAME); RX_AFS_GUNLOCK(); code = - RXAFS_Rename(tc->id, + RXAFS_Rename(rxconn, (struct AFSFid *)&aodp->f.fid.Fid, aname1, (struct AFSFid *)&andp->f.fid.Fid, @@ -187,7 +188,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, code = -1; } while (afs_Analyze - (tc, code, &andp->f.fid, areq, AFS_STATS_FS_RPCIDX_RENAME, + (tc, rxconn, code, &andp->f.fid, areq, AFS_STATS_FS_RPCIDX_RENAME, SHARED_LOCK, NULL)); } else { diff --git a/src/afs/VNOPS/afs_vnop_symlink.c b/src/afs/VNOPS/afs_vnop_symlink.c index 1ee329def..3754c9ca9 100644 --- a/src/afs/VNOPS/afs_vnop_symlink.c +++ b/src/afs/VNOPS/afs_vnop_symlink.c @@ -84,6 +84,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, struct AFSVolSync tsync; struct volume *volp = 0; struct afs_fakestat_state fakestate; + struct rx_connection *rxconn; XSTATS_DECLS; OSI_VC_CONVERT(adp); @@ -156,7 +157,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, * the copy will be invalidated */ if (!AFS_IS_DISCON_RW) { do { - tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK); + tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn); if (tc) { hostp = tc->parent->srvr->server; XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SYMLINK); @@ -164,7 +165,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, now = osi_Time(); RX_AFS_GUNLOCK(); code = - RXAFS_DFSSymlink(tc->id, + RXAFS_DFSSymlink(rxconn, (struct AFSFid *)&adp->f.fid.Fid, aname, atargetName, &InStatus, (struct AFSFid *)&newFid.Fid, @@ -174,7 +175,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else { RX_AFS_GUNLOCK(); code = - RXAFS_Symlink(tc->id, (struct AFSFid *)&adp->f.fid.Fid, + RXAFS_Symlink(rxconn, (struct AFSFid *)&adp->f.fid.Fid, aname, atargetName, &InStatus, (struct AFSFid *)&newFid.Fid, &OutFidStatus, &OutDirStatus, &tsync); @@ -184,7 +185,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } else code = -1; } while (afs_Analyze - (tc, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_SYMLINK, + (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_SYMLINK, SHARED_LOCK, NULL)); } else { newFid.Cell = adp->f.fid.Cell; diff --git a/src/afs/afs_analyze.c b/src/afs/afs_analyze.c index a10ed87bb..05d39a2fc 100644 --- a/src/afs/afs_analyze.c +++ b/src/afs/afs_analyze.c @@ -102,6 +102,7 @@ VLDB_Same(struct VenusFid *afid, struct vrequest *areq) char *bp, tbuf[CVBS]; /* biggest volume id is 2^32, ~ 4*10^9 */ unsigned int changed; struct server *(oldhosts[NMAXNSERVERS]); + struct rx_connection *rxconn; AFS_STATCNT(CheckVLDB); afs_FinalizeReq(areq); @@ -116,34 +117,34 @@ VLDB_Same(struct VenusFid *afid, struct vrequest *areq) VSleep(2); /* Better safe than sorry. */ tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cellNum, - &treq, SHARED_LOCK); + &treq, SHARED_LOCK, &rxconn); if (tconn) { if ( tconn->parent->srvr->server->flags & SNO_LHOSTS) { type = 0; RX_AFS_GUNLOCK(); - i = VL_GetEntryByNameO(tconn->id, bp, &v->tve); + i = VL_GetEntryByNameO(rxconn, bp, &v->tve); RX_AFS_GLOCK(); } else if (tconn->parent->srvr->server->flags & SYES_LHOSTS) { type = 1; RX_AFS_GUNLOCK(); - i = VL_GetEntryByNameN(tconn->id, bp, &v->ntve); + i = VL_GetEntryByNameN(rxconn, bp, &v->ntve); RX_AFS_GLOCK(); } else { type = 2; RX_AFS_GUNLOCK(); - i = VL_GetEntryByNameU(tconn->id, bp, &v->utve); + i = VL_GetEntryByNameU(rxconn, bp, &v->utve); RX_AFS_GLOCK(); if (!(tconn->parent->srvr->server->flags & SVLSRV_UUID)) { if (i == RXGEN_OPCODE) { type = 1; RX_AFS_GUNLOCK(); - i = VL_GetEntryByNameN(tconn->id, bp, &v->ntve); + i = VL_GetEntryByNameN(rxconn, bp, &v->ntve); RX_AFS_GLOCK(); if (i == RXGEN_OPCODE) { type = 0; tconn->parent->srvr->server->flags |= SNO_LHOSTS; RX_AFS_GUNLOCK(); - i = VL_GetEntryByNameO(tconn->id, bp, &v->tve); + i = VL_GetEntryByNameO(rxconn, bp, &v->tve); RX_AFS_GLOCK(); } else if (!i) tconn->parent->srvr->server->flags |= SYES_LHOSTS; @@ -154,7 +155,7 @@ VLDB_Same(struct VenusFid *afid, struct vrequest *areq) } } else i = -1; - } while (afs_Analyze(tconn, i, NULL, &treq, -1, /* no op code for this */ + } while (afs_Analyze(tconn, rxconn, i, NULL, &treq, -1, /* no op code for this */ SHARED_LOCK, tcell)); afs_PutCell(tcell, READ_LOCK); @@ -305,9 +306,9 @@ afs_BlackListOnce(struct vrequest *areq, struct VenusFid *afid, * if this is a temporary or permanent error. *------------------------------------------------------------------------*/ int -afs_Analyze(struct afs_conn *aconn, afs_int32 acode, - struct VenusFid *afid, struct vrequest *areq, int op, - afs_int32 locktype, struct cell *cellp) +afs_Analyze(struct afs_conn *aconn, struct rx_connection *rxconn, + afs_int32 acode, struct VenusFid *afid, struct vrequest *areq, + int op, afs_int32 locktype, struct cell *cellp) { afs_int32 i; struct srvAddr *sa; @@ -328,7 +329,7 @@ afs_Analyze(struct afs_conn *aconn, afs_int32 acode, if (aconn) { /* SXW - I suspect that this will _never_ happen - we shouldn't * get a connection because we're disconnected !!!*/ - afs_PutConn(aconn, locktype); + afs_PutConn(aconn, rxconn, locktype); } return 0; } @@ -447,7 +448,7 @@ afs_Analyze(struct afs_conn *aconn, afs_int32 acode, } } - afs_PutConn(aconn, locktype); + afs_PutConn(aconn, rxconn, locktype); return 0; } @@ -680,6 +681,6 @@ afs_Analyze(struct afs_conn *aconn, afs_int32 acode, } out: /* now unlock the connection and return */ - afs_PutConn(aconn, locktype); + afs_PutConn(aconn, rxconn, locktype); return (shouldRetry); } /*afs_Analyze */ diff --git a/src/afs/afs_bypasscache.c b/src/afs/afs_bypasscache.c index 6aafcabd4..c52ba16b0 100644 --- a/src/afs/afs_bypasscache.c +++ b/src/afs/afs_bypasscache.c @@ -513,6 +513,7 @@ afs_PrefetchNoCache(struct vcache *avc, struct iovec *iovecp; struct vrequest *areq; afs_int32 code = 0; + struct rx_connection *rxconn; #ifdef AFS_64BIT_CLIENT afs_int32 length_hi, bytes, locked; #endif @@ -532,10 +533,10 @@ afs_PrefetchNoCache(struct vcache *avc, tcallspec = (struct tlocal1 *) osi_Alloc(sizeof(struct tlocal1)); do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK /* ignored */); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK /* ignored */, &rxconn); if (tc) { avc->callback = tc->parent->srvr->server; - tcall = rx_NewCall(tc->id); + tcall = rx_NewCall(rxconn); #ifdef AFS_64BIT_CLIENT if (!afs_serverHasNo64Bit(tc)) { code = StartRXAFS_FetchData64(tcall, @@ -566,7 +567,7 @@ afs_PrefetchNoCache(struct vcache *avc, pos = auio->uio_offset; COND_GUNLOCK(locked); if (!tcall) - tcall = rx_NewCall(tc->id); + tcall = rx_NewCall(rxconn); code = StartRXAFS_FetchData(tcall, (struct AFSFid *) &avc->f.fid.Fid, pos, bparms->length); @@ -602,7 +603,7 @@ afs_PrefetchNoCache(struct vcache *avc, unlock_and_release_pages(auio); goto done; } - } while (afs_Analyze(tc, code, &avc->f.fid, areq, + } while (afs_Analyze(tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHDATA, SHARED_LOCK,0)); done: diff --git a/src/afs/afs_conn.c b/src/afs/afs_conn.c index fc4873c2c..abd0c186d 100644 --- a/src/afs/afs_conn.c +++ b/src/afs/afs_conn.c @@ -247,7 +247,7 @@ afs_pickSecurityObject(struct afs_conn *conn, int *secLevel) */ struct afs_conn * afs_Conn(struct VenusFid *afid, struct vrequest *areq, - afs_int32 locktype) + afs_int32 locktype, struct rx_connection **rxconn) { u_short fsport = AFS_FSPORT; struct volume *tv; @@ -258,6 +258,8 @@ afs_Conn(struct VenusFid *afid, struct vrequest *areq, int i; struct srvAddr *sa1p; + *rxconn = NULL; + AFS_STATCNT(afs_Conn); /* Get fid's volume. */ tv = afs_GetVolume(afid, areq, READ_LOCK); @@ -317,7 +319,7 @@ afs_Conn(struct VenusFid *afid, struct vrequest *areq, if (lowp) { tu = afs_GetUser(areq->uid, afid->Cell, SHARED_LOCK); tconn = afs_ConnBySA(lowp, fsport, afid->Cell, tu, 0 /*!force */ , - 1 /*create */ , locktype); + 1 /*create */ , locktype, rxconn); afs_PutUser(tu, SHARED_LOCK); } @@ -342,7 +344,7 @@ afs_Conn(struct VenusFid *afid, struct vrequest *areq, struct afs_conn * afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell, struct unixuser *tu, int force_if_down, afs_int32 create, - afs_int32 locktype) + afs_int32 locktype, struct rx_connection **rxconn) { int glocked, foundvec; struct afs_conn *tc = NULL; @@ -351,6 +353,8 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell, int isec; /*Security index */ int service; + *rxconn = NULL; + /* find cached connection */ ObtainSharedLock(&afs_xconn, 15); foundvec = 0; @@ -472,6 +476,9 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell, ConvertWToSLock(&afs_xconn); } /* end of if (tc->forceConnectFS)*/ + *rxconn = tc->id; + rx_GetConnection(*rxconn); + ReleaseSharedLock(&afs_xconn); return tc; } @@ -494,12 +501,15 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell, */ struct afs_conn * afs_ConnByHost(struct server *aserver, unsigned short aport, afs_int32 acell, - struct vrequest *areq, int aforce, afs_int32 locktype) + struct vrequest *areq, int aforce, afs_int32 locktype, + struct rx_connection **rxconn) { struct unixuser *tu; struct afs_conn *tc = NULL; struct srvAddr *sa = NULL; + *rxconn = NULL; + AFS_STATCNT(afs_ConnByHost); if (AFS_IS_DISCONNECTED && !AFS_IN_SYNC) { @@ -518,7 +528,7 @@ afs_ConnByHost(struct server *aserver, unsigned short aport, afs_int32 acell, for (sa = aserver->addr; sa; sa = sa->next_sa) { tc = afs_ConnBySA(sa, aport, acell, tu, aforce, 0 /*don't create one */ , - locktype); + locktype, rxconn); if (tc) break; } @@ -527,7 +537,7 @@ afs_ConnByHost(struct server *aserver, unsigned short aport, afs_int32 acell, for (sa = aserver->addr; sa; sa = sa->next_sa) { tc = afs_ConnBySA(sa, aport, acell, tu, aforce, 1 /*create one */ , - locktype); + locktype, rxconn); if (tc) break; } @@ -554,18 +564,20 @@ afs_ConnByHost(struct server *aserver, unsigned short aport, afs_int32 acell, struct afs_conn * afs_ConnByMHosts(struct server *ahosts[], unsigned short aport, afs_int32 acell, struct vrequest *areq, - afs_int32 locktype) + afs_int32 locktype, struct rx_connection **rxconn) { afs_int32 i; struct afs_conn *tconn; struct server *ts; + *rxconn = NULL; + /* try to find any connection from the set */ AFS_STATCNT(afs_ConnByMHosts); for (i = 0; i < AFS_MAXCELLHOSTS; i++) { if ((ts = ahosts[i]) == NULL) break; - tconn = afs_ConnByHost(ts, aport, acell, areq, 0, locktype); + tconn = afs_ConnByHost(ts, aport, acell, areq, 0, locktype, rxconn); if (tconn) { return tconn; } @@ -581,11 +593,13 @@ afs_ConnByMHosts(struct server *ahosts[], unsigned short aport, * @param locktype */ void -afs_PutConn(struct afs_conn *ac, afs_int32 locktype) +afs_PutConn(struct afs_conn *ac, struct rx_connection *rxconn, + afs_int32 locktype) { AFS_STATCNT(afs_PutConn); ac->refCount--; ac->parent->refCount--; + rx_PutConnection(rxconn); } /*afs_PutConn */ diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 0f703846c..0701224ba 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -1632,6 +1632,7 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte, int doAdjustSize = 0; int doReallyAdjustSize = 0; int overWriteWholeChunk = 0; + struct rx_connection *rxconn; #ifndef AFS_NOSTATS struct afs_stats_AccessInfo *accP; /*Ptr to access record in stats */ @@ -2193,7 +2194,7 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte, * tdc->lock(W) */ - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { #ifndef AFS_NOSTATS numFetchLoops++; @@ -2208,7 +2209,7 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte, setNewCallback = 1; } i = osi_Time(); - code = afs_CacheFetchProc(tc, file, Position, tdc, + code = afs_CacheFetchProc(tc, rxconn, file, Position, tdc, avc, size, tsmall); } else code = -1; @@ -2253,7 +2254,7 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte, } } while (afs_Analyze - (tc, code, &avc->f.fid, areq, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHDATA, SHARED_LOCK, NULL)); /* diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index 9de6e8c53..795412c00 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -552,6 +552,7 @@ afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq) struct AFSFetchStatus OutOldDirStatus, OutNewDirStatus; struct AFSVolSync tsync; struct afs_conn *tc; + struct rx_connection *rxconn; afs_uint32 code = 0; XSTATS_DECLS; @@ -604,11 +605,11 @@ afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq) /* Send to data to server. */ do { - tc = afs_Conn(&old_pdir_fid, areq, SHARED_LOCK); + tc = afs_Conn(&old_pdir_fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RENAME); RX_AFS_GUNLOCK(); - code = RXAFS_Rename(tc->id, + code = RXAFS_Rename(rxconn, (struct AFSFid *)&old_pdir_fid.Fid, old_name, (struct AFSFid *)&new_pdir_fid.Fid, @@ -622,6 +623,7 @@ afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq) code = -1; } while (afs_Analyze(tc, + rxconn, code, &new_pdir_fid, areq, @@ -658,6 +660,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, struct vcache *tdp = NULL, *tvc = NULL; struct dcache *tdc = NULL; struct afs_conn *tc; + struct rx_connection *rxconn; afs_int32 hash, new_hash, index; afs_size_t tlen; int code, op = 0; @@ -716,7 +719,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, InStatus.UnixModeBits = avc->f.m.Mode & 0xffff; do { - tc = afs_Conn(&tdp->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&tdp->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { switch (vType(avc)) { case VREG: @@ -724,7 +727,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, op = AFS_STATS_FS_RPCIDX_CREATEFILE; XSTATS_START_TIME(op); RX_AFS_GUNLOCK(); - code = RXAFS_CreateFile(tc->id, + code = RXAFS_CreateFile(rxconn, (struct AFSFid *)&tdp->f.fid.Fid, tname, &InStatus, (struct AFSFid *) &newFid.Fid, @@ -738,7 +741,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, op = AFS_STATS_FS_RPCIDX_MAKEDIR; XSTATS_START_TIME(op); RX_AFS_GUNLOCK(); - code = RXAFS_MakeDir(tc->id, (struct AFSFid *) &tdp->f.fid.Fid, + code = RXAFS_MakeDir(rxconn, (struct AFSFid *) &tdp->f.fid.Fid, tname, &InStatus, (struct AFSFid *) &newFid.Fid, &OutFidStatus, &OutDirStatus, @@ -751,7 +754,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, op = AFS_STATS_FS_RPCIDX_SYMLINK; XSTATS_START_TIME(op); RX_AFS_GUNLOCK(); - code = RXAFS_Symlink(tc->id, + code = RXAFS_Symlink(rxconn, (struct AFSFid *) &tdp->f.fid.Fid, tname, ttargetName, &InStatus, (struct AFSFid *) &newFid.Fid, @@ -766,7 +769,7 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, } } else code = -1; - } while (afs_Analyze(tc, code, &tdp->f.fid, areq, op, SHARED_LOCK, NULL)); + } while (afs_Analyze(tc, rxconn, code, &tdp->f.fid, areq, op, SHARED_LOCK, NULL)); /* TODO: Handle errors. */ if (code) { @@ -910,6 +913,7 @@ afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq) struct VenusFid pdir_fid; struct AFSVolSync tsync; struct afs_conn *tc; + struct rx_connection *rxconn; struct vcache *tdp = NULL; int code = 0; XSTATS_DECLS; @@ -935,11 +939,11 @@ afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq) if (vType(avc) == VREG || vType(avc) == VLNK) { /* Remove file on server. */ do { - tc = afs_Conn(&pdir_fid, areq, SHARED_LOCK); + tc = afs_Conn(&pdir_fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEFILE); RX_AFS_GUNLOCK(); - code = RXAFS_RemoveFile(tc->id, + code = RXAFS_RemoveFile(rxconn, &pdir_fid.Fid, tname, &OutDirStatus, @@ -950,6 +954,7 @@ afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq) } else code = -1; } while (afs_Analyze(tc, + rxconn, code, &pdir_fid, areq, @@ -960,11 +965,11 @@ afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq) } else if (vType(avc) == VDIR) { /* Remove dir on server. */ do { - tc = afs_Conn(&pdir_fid, areq, SHARED_LOCK); + tc = afs_Conn(&pdir_fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEDIR); RX_AFS_GUNLOCK(); - code = RXAFS_RemoveDir(tc->id, + code = RXAFS_RemoveDir(rxconn, &pdir_fid.Fid, tname, &OutDirStatus, @@ -974,6 +979,7 @@ afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq) } else code = -1; } while (afs_Analyze(tc, + rxconn, code, &pdir_fid, areq, @@ -1004,6 +1010,7 @@ int afs_SendChanges(struct vcache *avc, struct vrequest *areq) { struct afs_conn *tc; + struct rx_connection *rxconn; struct AFSStoreStatus sstat; struct AFSFetchStatus fstat; struct AFSVolSync tsync; @@ -1017,12 +1024,12 @@ afs_SendChanges(struct vcache *avc, struct vrequest *areq) /* Turn dirty vc data into a new store status... */ if (afs_GenStoreStatus(avc, &sstat) > 0) { do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { /* ... and send it. */ XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STORESTATUS); RX_AFS_GUNLOCK(); - code = RXAFS_StoreStatus(tc->id, + code = RXAFS_StoreStatus(rxconn, (struct AFSFid *) &avc->f.fid.Fid, &sstat, &fstat, @@ -1034,6 +1041,7 @@ afs_SendChanges(struct vcache *avc, struct vrequest *areq) code = -1; } while (afs_Analyze(tc, + rxconn, code, &avc->f.fid, areq, @@ -1055,7 +1063,7 @@ afs_SendChanges(struct vcache *avc, struct vrequest *areq) /* Truncate OP: */ do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { /* Set storing flags. XXX: A tad inefficient ... */ if (avc->f.ddirty_flags & VDisconWriteClose) @@ -1072,6 +1080,7 @@ afs_SendChanges(struct vcache *avc, struct vrequest *areq) code = -1; } while (afs_Analyze(tc, + rxconn, code, &avc->f.fid, areq, @@ -1101,6 +1110,7 @@ int afs_ResyncDisconFiles(struct vrequest *areq, afs_ucred_t *acred) { struct afs_conn *tc; + struct rx_connection *rxconn; struct vcache *tvc; struct AFSFetchStatus fstat; struct AFSCallBack callback; @@ -1141,11 +1151,11 @@ afs_ResyncDisconFiles(struct vrequest *areq, afs_ucred_t *acred) #if 0 /* Get server write lock. */ do { - tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SETLOCK); RX_AFS_GUNLOCK(); - code = RXAFS_SetLock(tc->id, + code = RXAFS_SetLock(rxconn, (struct AFSFid *)&tvc->f.fid.Fid, LockWrite, &tsync); @@ -1155,6 +1165,7 @@ afs_ResyncDisconFiles(struct vrequest *areq, afs_ucred_t *acred) code = -1; } while (afs_Analyze(tc, + rxconn, code, &tvc->f.fid, areq, @@ -1174,13 +1185,13 @@ afs_ResyncDisconFiles(struct vrequest *areq, afs_ucred_t *acred) /* Issue a FetchStatus to get info about DV and callbacks. */ do { - tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { tvc->callback = tc->parent->srvr->server; start = osi_Time(); XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHSTATUS); RX_AFS_GUNLOCK(); - code = RXAFS_FetchStatus(tc->id, + code = RXAFS_FetchStatus(rxconn, (struct AFSFid *)&tvc->f.fid.Fid, &fstat, &callback, @@ -1191,6 +1202,7 @@ afs_ResyncDisconFiles(struct vrequest *areq, afs_ucred_t *acred) code = -1; } while (afs_Analyze(tc, + rxconn, code, &tvc->f.fid, areq, @@ -1230,11 +1242,11 @@ unlock_srv_file: /* Release server write lock. */ #if 0 do { - tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_RELEASELOCK); RX_AFS_GUNLOCK(); - ucode = RXAFS_ReleaseLock(tc->id, + ucode = RXAFS_ReleaseLock(rxconn, (struct AFSFid *) &tvc->f.fid.Fid, &tsync); RX_AFS_GLOCK(); @@ -1242,6 +1254,7 @@ unlock_srv_file: } else ucode = -1; } while (afs_Analyze(tc, + rxconn, ucode, &tvc->f.fid, areq, diff --git a/src/afs/afs_fetchstore.c b/src/afs/afs_fetchstore.c index f34c96eb7..0f794f336 100644 --- a/src/afs/afs_fetchstore.c +++ b/src/afs/afs_fetchstore.c @@ -361,7 +361,8 @@ struct storeOps rxfs_storeMemOps = { }; afs_int32 -rxfs_storeInit(struct vcache *avc, struct afs_conn *tc, afs_size_t base, +rxfs_storeInit(struct vcache *avc, struct afs_conn *tc, + struct rx_connection *rxconn, afs_size_t base, afs_size_t bytes, afs_size_t length, int sync, struct storeOps **ops, void **rock) { @@ -382,7 +383,7 @@ rxfs_storeInit(struct vcache *avc, struct afs_conn *tc, afs_size_t base, if (sync & AFS_SYNC) v->InStatus.Mask |= AFS_FSYNC; RX_AFS_GUNLOCK(); - v->call = rx_NewCall(tc->id); + v->call = rx_NewCall(rxconn); if (v->call) { #ifdef AFS_64BIT_CLIENT if (!afs_serverHasNo64Bit(tc)) @@ -582,6 +583,7 @@ afs_CacheStoreVCache(struct dcache **dcList, struct vcache *avc, int nomore; unsigned int first = 0; struct afs_conn *tc; + struct rx_connection *rxconn; for (bytes = 0, j = 0; !code && j <= high; j++) { if (dcList[j]) { @@ -626,12 +628,12 @@ afs_CacheStoreVCache(struct dcache **dcList, struct vcache *avc, ICL_HANDLE_OFFSET(length)); do { - tc = afs_Conn(&avc->f.fid, areq, 0); + tc = afs_Conn(&avc->f.fid, areq, 0, &rxconn); #ifdef AFS_64BIT_CLIENT restart: #endif - code = rxfs_storeInit(avc, tc, base, bytes, length, + code = rxfs_storeInit(avc, tc, rxconn, base, bytes, length, sync, &ops, &rock); if ( !code ) { code = afs_CacheStoreDCaches(avc, dclist, bytes, anewDV, @@ -646,7 +648,7 @@ afs_CacheStoreVCache(struct dcache **dcList, struct vcache *avc, } #endif /* AFS_64BIT_CLIENT */ } while (afs_Analyze - (tc, code, &avc->f.fid, areq, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, SHARED_LOCK, NULL)); @@ -895,7 +897,8 @@ struct fetchOps rxfs_fetchMemOps = { }; afs_int32 -rxfs_fetchInit(struct afs_conn *tc, struct vcache *avc, afs_offs_t base, +rxfs_fetchInit(struct afs_conn *tc, struct rx_connection *rxconn, + struct vcache *avc, afs_offs_t base, afs_uint32 size, afs_int32 *alength, struct dcache *adc, struct osi_file *fP, struct fetchOps **ops, void **rock) { @@ -913,7 +916,7 @@ rxfs_fetchInit(struct afs_conn *tc, struct vcache *avc, afs_offs_t base, memset(v, 0, sizeof(struct rxfs_fetchVariables)); RX_AFS_GUNLOCK(); - v->call = rx_NewCall(tc->id); + v->call = rx_NewCall(rxconn); RX_AFS_GLOCK(); if (v->call) { #ifdef AFS_64BIT_CLIENT @@ -950,7 +953,7 @@ rxfs_fetchInit(struct afs_conn *tc, struct vcache *avc, afs_offs_t base, pos = base; RX_AFS_GUNLOCK(); if (!v->call) - v->call = rx_NewCall(tc->id); + v->call = rx_NewCall(rxconn); code = StartRXAFS_FetchData( v->call, (struct AFSFid*)&avc->f.fid.Fid, @@ -1054,7 +1057,8 @@ rxfs_fetchInit(struct afs_conn *tc, struct vcache *avc, afs_offs_t base, * Routine called on fetch; also tells people waiting for data * that more has arrived. * - * \param tc Ptr to the Rx connection structure. + * \param tc Ptr to the AFS connection structure. + * \param rxconn Ptr to the Rx connection structure. * \param fP File descriptor for the cache file. * \param base Base offset to fetch. * \param adc Ptr to the dcache entry for the file, write-locked. @@ -1065,7 +1069,8 @@ rxfs_fetchInit(struct afs_conn *tc, struct vcache *avc, afs_offs_t base, * \note Environment: Nothing interesting. */ int -afs_CacheFetchProc(struct afs_conn *tc, struct osi_file *fP, afs_size_t base, +afs_CacheFetchProc(struct afs_conn *tc, struct rx_connection *rxconn, + struct osi_file *fP, afs_size_t base, struct dcache *adc, struct vcache *avc, afs_int32 size, struct afs_FetchOutput *tsmall) { @@ -1094,7 +1099,7 @@ afs_CacheFetchProc(struct afs_conn *tc, struct osi_file *fP, afs_size_t base, * adc->lock(W) */ code = rxfs_fetchInit( - tc, avc, base, size, &length, adc, fP, &ops, &rock); + tc, rxconn, avc, base, size, &length, adc, fP, &ops, &rock); #ifndef AFS_NOSTATS osi_GetuTime(&xferStartTime); diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index e40f28167..fced77b92 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -1423,6 +1423,7 @@ DECL_PIOCTL(PSetAcl) struct AFSOpaque acl; struct AFSVolSync tsync; struct AFSFetchStatus OutStatus; + struct rx_connection *rxconn; XSTATS_DECLS; AFS_STATCNT(PSetAcl); @@ -1436,19 +1437,19 @@ DECL_PIOCTL(PSetAcl) return EINVAL; do { - tconn = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tconn = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tconn) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STOREACL); RX_AFS_GUNLOCK(); code = - RXAFS_StoreACL(tconn->id, (struct AFSFid *)&avc->f.fid.Fid, + RXAFS_StoreACL(rxconn, (struct AFSFid *)&avc->f.fid.Fid, &acl, &OutStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREACL, + (tconn, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREACL, SHARED_LOCK, NULL)); /* now we've forgotten all of the access info */ @@ -1563,6 +1564,7 @@ DECL_PIOCTL(PGetAcl) afs_int32 code; struct afs_conn *tconn; struct AFSFid Fid; + struct rx_connection *rxconn; XSTATS_DECLS; AFS_STATCNT(PGetAcl); @@ -1585,18 +1587,18 @@ DECL_PIOCTL(PGetAcl) } acl.AFSOpaque_val = aout->ptr; do { - tconn = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tconn = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tconn) { acl.AFSOpaque_val[0] = '\0'; XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHACL); RX_AFS_GUNLOCK(); - code = RXAFS_FetchACL(tconn->id, &Fid, &acl, &OutStatus, &tsync); + code = RXAFS_FetchACL(rxconn, &Fid, &acl, &OutStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHACL, + (tconn, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_FETCHACL, SHARED_LOCK, NULL)); if (code == 0) { @@ -1958,6 +1960,7 @@ DECL_PIOCTL(PGetVolumeStatus) afs_int32 code = 0; struct AFSFetchVolumeStatus volstat; char *Name; + struct rx_connection *rxconn; XSTATS_DECLS; osi_Assert(offLineMsg != NULL); @@ -1969,19 +1972,19 @@ DECL_PIOCTL(PGetVolumeStatus) } Name = volName; do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_GETVOLUMESTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_GetVolumeStatus(tc->id, avc->f.fid.Fid.Volume, &volstat, + RXAFS_GetVolumeStatus(rxconn, avc->f.fid.Fid.Volume, &volstat, &Name, &offLineMsg, &motd); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_GETVOLUMESTATUS, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_GETVOLUMESTATUS, SHARED_LOCK, NULL)); if (code) @@ -2035,6 +2038,7 @@ DECL_PIOCTL(PSetVolumeStatus) struct AFSFetchVolumeStatus volstat; struct AFSStoreVolumeStatus storeStat; struct volume *tvp; + struct rx_connection *rxconn; XSTATS_DECLS; AFS_STATCNT(PSetVolumeStatus); @@ -2082,19 +2086,19 @@ DECL_PIOCTL(PSetVolumeStatus) storeStat.Mask |= AFS_SETMAXQUOTA; } do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_SetVolumeStatus(tc->id, avc->f.fid.Fid.Volume, &storeStat, + RXAFS_SetVolumeStatus(rxconn, avc->f.fid.Fid.Volume, &storeStat, volName, offLineMsg, motd); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS, SHARED_LOCK, NULL)); if (code) @@ -2957,6 +2961,7 @@ DECL_PIOCTL(PRemoveCallBack) struct AFSCallBack CallBacks_Array[1]; struct AFSCBFids theFids; struct AFSCBs theCBs; + struct rx_connection *rxconn; XSTATS_DECLS; AFS_STATCNT(PRemoveCallBack); @@ -2972,17 +2977,17 @@ DECL_PIOCTL(PRemoveCallBack) CallBacks_Array[0].CallBackType = CB_DROPPED; if (avc->callback) { do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS); RX_AFS_GUNLOCK(); - code = RXAFS_GiveUpCallBacks(tc->id, &theFids, &theCBs); + code = RXAFS_GiveUpCallBacks(rxconn, &theFids, &theCBs); RX_AFS_GLOCK(); XSTATS_END_TIME; } /* don't set code on failure since we wouldn't use it */ } while (afs_Analyze - (tc, code, &avc->f.fid, areq, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS, SHARED_LOCK, NULL)); ObtainWriteLock(&afs_xcbhash, 457); @@ -3223,6 +3228,7 @@ DECL_PIOCTL(PRemoveMount) struct AFSFetchStatus OutDirStatus; struct VenusFid tfid; struct AFSVolSync tsync; + struct rx_connection *rxconn; XSTATS_DECLS; /* "ain" is the name of the file in this dir to remove */ @@ -3290,19 +3296,19 @@ DECL_PIOCTL(PRemoveMount) ObtainWriteLock(&avc->lock, 231); osi_dnlc_remove(avc, bufp, tvc); do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEFILE); RX_AFS_GUNLOCK(); code = - RXAFS_RemoveFile(tc->id, (struct AFSFid *)&avc->f.fid.Fid, bufp, + RXAFS_RemoveFile(rxconn, (struct AFSFid *)&avc->f.fid.Fid, bufp, &OutDirStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_REMOVEFILE, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_REMOVEFILE, SHARED_LOCK, NULL)); if (code) { @@ -4909,6 +4915,7 @@ DECL_PIOCTL(PPrefetchFromTape) struct VenusFid tfid; struct AFSFid *Fid; struct vcache *tvc; + struct rx_connection *rxconn; AFS_STATCNT(PSetAcl); if (!avc) @@ -4933,11 +4940,11 @@ DECL_PIOCTL(PPrefetchFromTape) ICL_TYPE_FID, &tfid, ICL_TYPE_FID, &tvc->f.fid); do { - tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { RX_AFS_GUNLOCK(); - tcall = rx_NewCall(tc->id); + tcall = rx_NewCall(rxconn); code = StartRXAFS_FetchData(tcall, (struct AFSFid *)&tvc->f.fid.Fid, 0, 0); @@ -4951,7 +4958,7 @@ DECL_PIOCTL(PPrefetchFromTape) } else code = -1; } while (afs_Analyze - (tc, code, &tvc->f.fid, areq, AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, + (tc, rxconn, code, &tvc->f.fid, areq, AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK, NULL)); /* This call is done only to have the callback things handled correctly */ afs_FetchStatus(tvc, &tfid, areq, &OutStatus); @@ -4972,6 +4979,7 @@ DECL_PIOCTL(PFsCmd) struct FsCmdOutputs *Outputs; struct VenusFid tfid; struct AFSFid *Fid; + struct rx_connection *rxconn; if (!avc) return EINVAL; @@ -5001,17 +5009,17 @@ DECL_PIOCTL(PFsCmd) if (Inputs->command) { do { - tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { RX_AFS_GUNLOCK(); code = - RXAFS_FsCmd(tc->id, Fid, Inputs, + RXAFS_FsCmd(rxconn, Fid, Inputs, (struct FsCmdOutputs *)aout); RX_AFS_GLOCK(); } else code = -1; } while (afs_Analyze - (tc, code, &tvc->f.fid, areq, + (tc, rxconn, code, &tvc->f.fid, areq, AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK, NULL)); /* This call is done to have the callback things handled correctly */ afs_FetchStatus(tvc, &tfid, areq, &Outputs->status); @@ -5097,6 +5105,7 @@ DECL_PIOCTL(PCallBackAddr) afs_int32 i, j; struct unixuser *tu; struct srvAddr **addrs; + struct rx_connection *rxconn; /*AFS_STATCNT(PCallBackAddr); */ if (!afs_resourceinit_flag) /* afs deamons havn't started yet */ @@ -5160,24 +5169,24 @@ DECL_PIOCTL(PCallBackAddr) /* get a connection, even if host is down; bumps conn ref count */ tu = afs_GetUser(areq->uid, ts->cell->cellNum, SHARED_LOCK); tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu, - 1 /*force */ , 1 /*create */ , SHARED_LOCK); + 1 /*force */ , 1 /*create */ , SHARED_LOCK, &rxconn); afs_PutUser(tu, SHARED_LOCK); if (!tc) continue; if ((sa->sa_flags & SRVADDR_ISDOWN) || afs_HaveCallBacksFrom(ts)) { if (sa->sa_flags & SRVADDR_ISDOWN) { - rx_SetConnDeadTime(tc->id, 3); + rx_SetConnDeadTime(rxconn, 3); } #ifdef RX_ENABLE_LOCKS AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ - code = RXAFS_CallBackRxConnAddr(tc->id, &addr); + code = RXAFS_CallBackRxConnAddr(rxconn, &addr); #ifdef RX_ENABLE_LOCKS AFS_GLOCK(); #endif /* RX_ENABLE_LOCKS */ } - afs_PutConn(tc, SHARED_LOCK); /* done with it now */ + afs_PutConn(tc, rxconn, SHARED_LOCK); /* done with it now */ } /* Outer loop over addrs */ #endif /* UKERNEL */ return 0; diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index cb86042f3..95f8ba0b8 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -11,8 +11,9 @@ #define _AFS_PROTOTYPES_H_ /* afs_analyze.c */ -extern int afs_Analyze(struct afs_conn *aconn, afs_int32 acode, - struct VenusFid *afid, struct vrequest *areq, +extern int afs_Analyze(struct afs_conn *aconn, struct rx_connection *rxconn, + afs_int32 acode, struct VenusFid *afid, + struct vrequest *areq, int op, afs_int32 locktype, struct cell *cellp); /* afs_axscache.c */ @@ -176,20 +177,25 @@ extern afs_rwlock_t afs_xinterface; extern afs_rwlock_t afs_xconn; extern struct afs_conn *afs_Conn(struct VenusFid *afid, struct vrequest *areq, - afs_int32 locktype); + afs_int32 locktype, + struct rx_connection **rxconn); extern struct afs_conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell, struct unixuser *tu, int force_if_down, afs_int32 create, - afs_int32 locktype); + afs_int32 locktype, + struct rx_connection **rxconn); extern struct afs_conn *afs_ConnByMHosts(struct server *ahosts[], unsigned short aport, afs_int32 acell, struct vrequest *areq, - afs_int32 locktype); + afs_int32 locktype, + struct rx_connection **rxconn); extern struct afs_conn *afs_ConnByHost(struct server *aserver, unsigned short aport, afs_int32 acell, struct vrequest *areq, int aforce, - afs_int32 locktype); -extern void afs_PutConn(struct afs_conn *ac, afs_int32 locktype); + afs_int32 locktype, + struct rx_connection **rxconn); +extern void afs_PutConn(struct afs_conn *ac, struct rx_connection *rxconn, + afs_int32 locktype); extern void afs_ReleaseConns(struct sa_conn_vector *tcv); extern void afs_ReleaseConnsUser(register struct unixuser *au); extern void ForceNewConnections(struct srvAddr *sap); @@ -496,7 +502,8 @@ extern int afs_CacheStoreVCache(struct dcache **dcList, struct vcache *avc, unsigned int high, unsigned int moredata, afs_hyper_t *anewDV, afs_size_t *amaxStoredLength); -extern int afs_CacheFetchProc(struct afs_conn *tc, struct osi_file *fP, +extern int afs_CacheFetchProc(struct afs_conn *tc, struct rx_connection *rxconn, + struct osi_file *fP, afs_size_t abase, struct dcache *adc, struct vcache *avc, afs_int32 size, struct afs_FetchOutput *tsmall); diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index 7dc9d98a0..56a539d48 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -44,6 +44,7 @@ afs_StoreMini(struct vcache *avc, struct vrequest *areq) struct AFSVolSync tsync; afs_int32 code; struct rx_call *tcall; + struct rx_connection *rxconn; afs_size_t tlen, xlen = 0; XSTATS_DECLS; AFS_STATCNT(afs_StoreMini); @@ -56,13 +57,13 @@ afs_StoreMini(struct vcache *avc, struct vrequest *areq) avc->f.states &= ~CExtendedFile; do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { #ifdef AFS_64BIT_CLIENT retry: #endif RX_AFS_GUNLOCK(); - tcall = rx_NewCall(tc->id); + tcall = rx_NewCall(rxconn); RX_AFS_GLOCK(); /* Set the client mod time since we always want the file * to have the client's mod time and not the server's one @@ -126,7 +127,7 @@ afs_StoreMini(struct vcache *avc, struct vrequest *areq) } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, SHARED_LOCK, NULL)); if (code == 0) diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index 1c5d7f789..010f0b882 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -288,6 +288,7 @@ CheckVLServer(struct srvAddr *sa, struct vrequest *areq) struct server *aserver = sa->server; struct afs_conn *tc; afs_int32 code; + struct rx_connection *rxconn; AFS_STATCNT(CheckVLServer); /* Ping dead servers to see if they're back */ @@ -298,16 +299,16 @@ CheckVLServer(struct srvAddr *sa, struct vrequest *areq) return; /* can't do much */ tc = afs_ConnByHost(aserver, aserver->cell->vlport, - aserver->cell->cellNum, areq, 1, SHARED_LOCK); + aserver->cell->cellNum, areq, 1, SHARED_LOCK, &rxconn); if (!tc) return; - rx_SetConnDeadTime(tc->id, 3); + rx_SetConnDeadTime(rxconn, 3); RX_AFS_GUNLOCK(); - code = VL_ProbeServer(tc->id); + code = VL_ProbeServer(rxconn); RX_AFS_GLOCK(); - rx_SetConnDeadTime(tc->id, afs_rx_deadtime); - afs_PutConn(tc, SHARED_LOCK); + rx_SetConnDeadTime(rxconn, afs_rx_deadtime); + afs_PutConn(tc, rxconn, SHARED_LOCK); /* * If probe worked, or probe call not yet defined (for compatibility * with old vlsevers), then we treat this server as running again @@ -591,7 +592,7 @@ CkSrv_SetTime(struct rx_connection **rxconns, int nconns, int nservers, tc = conns[multi_i]; sa = tc->parent->srvr; if (conntimer[multi_i] == 1) - rx_SetConnDeadTime(tc->id, afs_rx_deadtime); + rx_SetConnDeadTime(rxconns[multi_i], afs_rx_deadtime); end = osi_Time(); results[multi_i]=multi_error; if ((start == end) && !multi_error) @@ -824,6 +825,7 @@ afs_LoopServers(int adown, struct cell *acellp, int vlalso, osi_Assert(results != NULL); for (i = 0; i < j; i++) { + struct rx_connection *rxconn; sa = addrs[i]; ts = sa->server; if (!ts) @@ -852,7 +854,7 @@ afs_LoopServers(int adown, struct cell *acellp, int vlalso, /* get a connection, even if host is down; bumps conn ref count */ tu = afs_GetUser(treq.uid, ts->cell->cellNum, SHARED_LOCK); tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu, - 1 /*force */ , 1 /*create */ , SHARED_LOCK); + 1 /*force */ , 1 /*create */ , SHARED_LOCK, &rxconn); afs_PutUser(tu, SHARED_LOCK); if (!tc) continue; @@ -860,9 +862,9 @@ afs_LoopServers(int adown, struct cell *acellp, int vlalso, if ((sa->sa_flags & SRVADDR_ISDOWN) || afs_HaveCallBacksFrom(sa->server) || (tc->parent->srvr->server == afs_setTimeHost)) { conns[nconns]=tc; - rxconns[nconns]=tc->id; + rxconns[nconns]=rxconn; if (sa->sa_flags & SRVADDR_ISDOWN) { - rx_SetConnDeadTime(tc->id, 3); + rx_SetConnDeadTime(rxconn, 3); conntimer[nconns]=1; } else { conntimer[nconns]=0; @@ -879,8 +881,8 @@ afs_LoopServers(int adown, struct cell *acellp, int vlalso, for (i = 0; i < nconns; i++) { if (conntimer[i] == 1) - rx_SetConnDeadTime(tc->id, afs_rx_deadtime); - afs_PutConn(conns[i], SHARED_LOCK); /* done with it now */ + rx_SetConnDeadTime(rxconns[i], afs_rx_deadtime); + afs_PutConn(conns[i], rxconns[i], SHARED_LOCK); /* done with it now */ } afs_osi_Free(addrs, srvAddrCount * sizeof(*addrs)); @@ -1773,6 +1775,7 @@ afs_GetCapabilities(struct server *ts) struct vrequest treq; struct afs_conn *tc; struct unixuser *tu; + struct rx_connection *rxconn; afs_int32 code; if ( !ts || !ts->cell ) @@ -1786,19 +1789,20 @@ afs_GetCapabilities(struct server *ts) if ( !tu ) return; tc = afs_ConnBySA(ts->addr, ts->cell->fsport, ts->cell->cellNum, tu, 0, 1, - SHARED_LOCK); + SHARED_LOCK, + &rxconn); if ( !tc ) return; /* InitCallBackStateN, triggered by our RPC, may need this */ ReleaseWriteLock(&afs_xserver); - code = RXAFS_GetCapabilities(tc->id, &caps); + code = RXAFS_GetCapabilities(rxconn, &caps); ObtainWriteLock(&afs_xserver, 723); /* we forced a conn above; important we mark it down if needed */ if ((code < 0) && (code != RXGEN_OPCODE)) { afs_ServerDown(tc->parent->srvr); ForceNewConnections(tc->parent->srvr); /* multi homed clients */ } - afs_PutConn(tc, SHARED_LOCK); + afs_PutConn(tc, rxconn, SHARED_LOCK); if ( code && code != RXGEN_OPCODE ) { afs_warn("RXAFS_GetCapabilities failed with code %d\n", code); /* better not be anything to free. we failed! */ diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index d9f623f18..68704635a 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -442,6 +442,7 @@ afs_FlushVCBs(afs_int32 lockit) tcount = 0; /* number found so far */ for (safety2 = 0; safety2 < afs_cacheStats; safety2++) { if (tcount >= AFS_MAXCBRSCALL || !tsp->cbrs) { + struct rx_connection *rxconn; /* if buffer is full, or we've queued all we're going * to from this server, we should flush out the * callbacks. @@ -455,20 +456,20 @@ afs_FlushVCBs(afs_int32 lockit) for (safety3 = 0; safety3 < AFS_MAXHOSTS * 2; safety3++) { tc = afs_ConnByHost(tsp, tsp->cell->fsport, tsp->cell->cellNum, &treq, 0, - SHARED_LOCK); + SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME (AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS); RX_AFS_GUNLOCK(); code = - RXAFS_GiveUpCallBacks(tc->id, &fidArray, + RXAFS_GiveUpCallBacks(rxconn, &fidArray, &cbArray); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; if (!afs_Analyze - (tc, code, 0, &treq, + (tc, rxconn, code, 0, &treq, AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS, SHARED_LOCK, tsp->cell)) { break; @@ -979,6 +980,7 @@ afs_FlushActiveVcaches(afs_int32 doflocks) tvc->flockCount)) panic("Dead vnode has core/unlinkedel/flock"); #endif if (doflocks && tvc->flockCount != 0) { + struct rx_connection *rxconn; /* if this entry has an flock, send a keep-alive call out */ osi_vnhold(tvc, 0); ReleaseReadLock(&afs_xvcache); @@ -987,12 +989,12 @@ afs_FlushActiveVcaches(afs_int32 doflocks) afs_InitReq(&treq, afs_osi_credp); treq.flags |= O_NONBLOCK; - tc = afs_Conn(&tvc->f.fid, &treq, SHARED_LOCK); + tc = afs_Conn(&tvc->f.fid, &treq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_EXTENDLOCK); RX_AFS_GUNLOCK(); code = - RXAFS_ExtendLock(tc->id, + RXAFS_ExtendLock(rxconn, (struct AFSFid *)&tvc->f.fid.Fid, &tsync); RX_AFS_GLOCK(); @@ -1000,7 +1002,7 @@ afs_FlushActiveVcaches(afs_int32 doflocks) } else code = -1; } while (afs_Analyze - (tc, code, &tvc->f.fid, &treq, + (tc, rxconn, code, &tvc->f.fid, &treq, AFS_STATS_FS_RPCIDX_EXTENDLOCK, SHARED_LOCK, NULL)); ReleaseWriteLock(&tvc->lock); @@ -1285,24 +1287,25 @@ afs_WriteVCache(struct vcache *avc, struct afs_conn *tc; struct AFSFetchStatus OutStatus; struct AFSVolSync tsync; + struct rx_connection *rxconn; XSTATS_DECLS; AFS_STATCNT(afs_WriteVCache); afs_Trace2(afs_iclSetp, CM_TRACE_WVCACHE, ICL_TYPE_POINTER, avc, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length)); do { - tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK); + tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK, &rxconn); if (tc) { XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STORESTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_StoreStatus(tc->id, (struct AFSFid *)&avc->f.fid.Fid, + RXAFS_StoreStatus(rxconn, (struct AFSFid *)&avc->f.fid.Fid, astatus, &OutStatus, &tsync); RX_AFS_GLOCK(); XSTATS_END_TIME; } else code = -1; } while (afs_Analyze - (tc, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STORESTATUS, + (tc, rxconn, code, &avc->f.fid, areq, AFS_STATS_FS_RPCIDX_STORESTATUS, SHARED_LOCK, NULL)); UpgradeSToWLock(&avc->lock, 20); @@ -1526,19 +1529,20 @@ afs_RemoteLookup(struct VenusFid *afid, struct vrequest *areq, { afs_int32 code; struct afs_conn *tc; + struct rx_connection *rxconn; struct AFSFetchStatus OutDirStatus; XSTATS_DECLS; if (!name) name = ""; /* XXX */ do { - tc = afs_Conn(afid, areq, SHARED_LOCK); + tc = afs_Conn(afid, areq, SHARED_LOCK, &rxconn); if (tc) { if (serverp) *serverp = tc->parent->srvr->server; XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_XLOOKUP); RX_AFS_GUNLOCK(); code = - RXAFS_Lookup(tc->id, (struct AFSFid *)&afid->Fid, name, + RXAFS_Lookup(rxconn, (struct AFSFid *)&afid->Fid, name, (struct AFSFid *)&nfid->Fid, OutStatusp, &OutDirStatus, CallBackp, tsyncp); RX_AFS_GLOCK(); @@ -1546,7 +1550,7 @@ afs_RemoteLookup(struct VenusFid *afid, struct vrequest *areq, } else code = -1; } while (afs_Analyze - (tc, code, afid, areq, AFS_STATS_FS_RPCIDX_XLOOKUP, SHARED_LOCK, + (tc, rxconn, code, afid, areq, AFS_STATS_FS_RPCIDX_XLOOKUP, SHARED_LOCK, NULL)); return code; @@ -2313,9 +2317,10 @@ afs_FetchStatus(struct vcache * avc, struct VenusFid * afid, struct afs_conn *tc; struct AFSCallBack CallBack; struct AFSVolSync tsync; + struct rx_connection *rxconn; XSTATS_DECLS; do { - tc = afs_Conn(afid, areq, SHARED_LOCK); + tc = afs_Conn(afid, areq, SHARED_LOCK, &rxconn); avc->dchint = NULL; /* invalidate hints */ if (tc) { avc->callback = tc->parent->srvr->server; @@ -2323,7 +2328,7 @@ afs_FetchStatus(struct vcache * avc, struct VenusFid * afid, XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHSTATUS); RX_AFS_GUNLOCK(); code = - RXAFS_FetchStatus(tc->id, (struct AFSFid *)&afid->Fid, Outsp, + RXAFS_FetchStatus(rxconn, (struct AFSFid *)&afid->Fid, Outsp, &CallBack, &tsync); RX_AFS_GLOCK(); @@ -2332,7 +2337,7 @@ afs_FetchStatus(struct vcache * avc, struct VenusFid * afid, } else code = -1; } while (afs_Analyze - (tc, code, afid, areq, AFS_STATS_FS_RPCIDX_FETCHSTATUS, + (tc, rxconn, code, afid, areq, AFS_STATS_FS_RPCIDX_FETCHSTATUS, SHARED_LOCK, NULL)); if (!code) { diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 60671dd58..c83dcccd1 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -739,6 +739,7 @@ afs_NewVolumeByName(char *aname, afs_int32 acell, int agood, char *tbuffer, *ve; struct afs_conn *tconn; struct vrequest treq; + struct rx_connection *rxconn; if (strlen(aname) > VL_MAXNAMELEN) /* Invalid volume name */ return NULL; @@ -763,34 +764,34 @@ afs_NewVolumeByName(char *aname, afs_int32 acell, int agood, do { tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cellNum, - &treq, SHARED_LOCK); + &treq, SHARED_LOCK, &rxconn); if (tconn) { if (tconn->parent->srvr->server->flags & SNO_LHOSTS) { type = 0; RX_AFS_GUNLOCK(); - code = VL_GetEntryByNameO(tconn->id, aname, tve); + code = VL_GetEntryByNameO(rxconn, aname, tve); RX_AFS_GLOCK(); } else if (tconn->parent->srvr->server->flags & SYES_LHOSTS) { type = 1; RX_AFS_GUNLOCK(); - code = VL_GetEntryByNameN(tconn->id, aname, ntve); + code = VL_GetEntryByNameN(rxconn, aname, ntve); RX_AFS_GLOCK(); } else { type = 2; RX_AFS_GUNLOCK(); - code = VL_GetEntryByNameU(tconn->id, aname, utve); + code = VL_GetEntryByNameU(rxconn, aname, utve); RX_AFS_GLOCK(); if (!(tconn->parent->srvr->server->flags & SVLSRV_UUID)) { if (code == RXGEN_OPCODE) { type = 1; RX_AFS_GUNLOCK(); - code = VL_GetEntryByNameN(tconn->id, aname, ntve); + code = VL_GetEntryByNameN(rxconn, aname, ntve); RX_AFS_GLOCK(); if (code == RXGEN_OPCODE) { type = 0; tconn->parent->srvr->server->flags |= SNO_LHOSTS; RX_AFS_GUNLOCK(); - code = VL_GetEntryByNameO(tconn->id, aname, tve); + code = VL_GetEntryByNameO(rxconn, aname, tve); RX_AFS_GLOCK(); } else if (!code) tconn->parent->srvr->server->flags |= SYES_LHOSTS; @@ -801,7 +802,7 @@ afs_NewVolumeByName(char *aname, afs_int32 acell, int agood, } } else code = -1; - } while (afs_Analyze(tconn, code, NULL, &treq, -1, /* no op code for this */ + } while (afs_Analyze(tconn, rxconn, code, NULL, &treq, -1, /* no op code for this */ SHARED_LOCK, tcell)); if (code) { @@ -1113,6 +1114,7 @@ InstallUVolumeEntry(struct volume *av, struct uvldbentry *ve, int acell, bulkaddrs addrs; ListAddrByAttributes attrs; afsUUID uuid; + struct rx_connection *rxconn; memset(&attrs, 0, sizeof(attrs)); attrs.Mask = VLADDR_UUID; @@ -1122,11 +1124,12 @@ InstallUVolumeEntry(struct volume *av, struct uvldbentry *ve, int acell, do { tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, - tcell->cellNum, areq, SHARED_LOCK); + tcell->cellNum, areq, SHARED_LOCK, + &rxconn); if (tconn) { RX_AFS_GUNLOCK(); code = - VL_GetAddrsU(tconn->id, &attrs, &uuid, &unique, + VL_GetAddrsU(rxconn, &attrs, &uuid, &unique, &nentries, &addrs); RX_AFS_GLOCK(); } else { @@ -1138,7 +1141,7 @@ InstallUVolumeEntry(struct volume *av, struct uvldbentry *ve, int acell, code = VL_NOENT; } while (afs_Analyze - (tconn, code, NULL, areq, -1, SHARED_LOCK, tcell)); + (tconn, rxconn, code, NULL, areq, -1, SHARED_LOCK, tcell)); if (code) { /* Better handing of such failures; for now we'll simply retry this call */ areq->volumeError = 1;