From cefe48fc1353c0f5e2831b8b81443d35e983fc96 Mon Sep 17 00:00:00 2001 From: Chaskiel M Grundman Date: Sat, 12 Feb 2005 19:47:03 +0000 Subject: [PATCH] store64-cleanup-20050212 fix several deficiencies in 64 bit file size handling --- src/afs/afs_dcache.c | 3 ++- src/afs/afs_memcache.c | 6 ++++-- src/afs/afs_segments.c | 29 ++++++++++++++--------------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index f231db2841..3abdaa37ff 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -1301,8 +1301,9 @@ afs_UFSCacheStoreProc(register struct rx_call *acall, struct osi_file *afile, (*abytesXferredP) += code; #endif /* AFS_NOSTATS */ if (code != got) { + code = rx_Error(acall); osi_FreeLargeSpace(tbuffer); - return -33; + return code ? code : -33; } alen -= got; /* diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index a44931789a..a5ffe96f18 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -383,8 +383,9 @@ afs_MemCacheStoreProc(register struct rx_call *acall, code = rx_WritevAlloc(acall, tiov, &tnio, RX_MAXIOVECS, tlen); RX_AFS_GLOCK(); if (code <= 0) { + code = rx_Error(acall); osi_FreeSmallSpace(tiov); - return -33; + return code ? code : -33; } tlen = code; code = afs_MemReadvBlk(mceP, offset, tiov, tnio, tlen); @@ -399,8 +400,9 @@ afs_MemCacheStoreProc(register struct rx_call *acall, (*abytesXferredP) += code; #endif /* AFS_NOSTATS */ if (code != tlen) { + code = rx_Error(acall); osi_FreeSmallSpace(tiov); - return -33; + return code ? code : -33; } offset += tlen; alen -= tlen; diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index 23c0a4571d..d9b6e8dac9 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -60,8 +60,8 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) do { tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); if (tc) { - RX_AFS_GUNLOCK(); retry: + RX_AFS_GUNLOCK(); tcall = rx_NewCall(tc->id); RX_AFS_GLOCK(); /* Set the client mod time since we always want the file @@ -104,17 +104,16 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) #endif /* AFS_64BIT_CLIENT */ if (code == 0) { code = EndRXAFS_StoreData(tcall, &OutStatus, &tsync); -#ifdef AFS_64BIT_CLIENT - if (code == RXGEN_OPCODE) { - afs_serverSetNo64Bit(tc); - code = rx_EndCall(tcall, code); - goto retry; - } -#endif /* AFS_64BIT_CLIENT */ } code = rx_EndCall(tcall, code); RX_AFS_GLOCK(); XSTATS_END_TIME; +#ifdef AFS_64BIT_CLIENT + if (code == RXGEN_OPCODE && !afs_serverHasNo64Bit(tc)) { + afs_serverSetNo64Bit(tc); + goto retry; + } +#endif /* AFS_64BIT_CLIENT */ } else code = -1; } while (afs_Analyze @@ -508,14 +507,8 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, shouldwake, &lp1, &lp2); #endif /* AFS_NOSTATS */ afs_CFileClose(tfile); -#ifdef AFS_64BIT_CLIENT - if (code == RXGEN_OPCODE) { - afs_serverSetNo64Bit(tc); - goto restart; - } -#endif /* AFS_64BIT_CLIENT */ if ((tdc->f.chunkBytes < afs_OtherCSize) - && (i < (nchunks - 1))) { + && (i < (nchunks - 1)) && code == 0) { int bsent, tlen, sbytes = afs_OtherCSize - tdc->f.chunkBytes; char *tbuffer = @@ -567,6 +560,12 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, if (code2) code = code2; } +#ifdef AFS_64BIT_CLIENT + if (code == RXGEN_OPCODE && !afs_serverHasNo64Bit(tc)) { + afs_serverSetNo64Bit(tc); + goto restart; + } +#endif /* AFS_64BIT_CLIENT */ } while (afs_Analyze (tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, SHARED_LOCK,