From: Michael Meffie Date: Fri, 16 Mar 2018 14:25:18 +0000 (-0500) Subject: afs: make sure to call afs_Analyze after afs_Conn X-Git-Tag: debian/1.8.4_pre1-1~9^2^2~34 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1a4e785f0d92f6e628a79bb8919085bfaa279fe6;p=packages%2Fo%2Fopenafs.git afs: make sure to call afs_Analyze after afs_Conn The afs_Conn function is used to pick a connection for a given RPC. The RPC is normally wrapped within a do-while loop which calls afs_Analyze to handle the RPC code and manage the server connection references. Among other things, afs_Analyze can mark the server as down, blacklist idle servers, etc. There are some special cases in which we break out of this do-while loop early, by putting the connection reference given by afs_Conn and then jumping out of the loop. In these cases, be sure to call afs_Analyze to put the server connection we got from afs_Conn, and to handle the RPC return code, possibly marking the server as down or blacklisted. Reviewed-on: https://gerrit.openafs.org/13288 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 0835d7c2a183f896096684df06258aefd297f080) Change-Id: Ic5648dbd250c33988d64284b906b3829a396a2cb Reviewed-on: https://gerrit.openafs.org/13511 Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/afs/afs_bypasscache.c b/src/afs/afs_bypasscache.c index 847eaf0b1..64da1ed19 100644 --- a/src/afs/afs_bypasscache.c +++ b/src/afs/afs_bypasscache.c @@ -614,7 +614,9 @@ afs_PrefetchNoCache(struct vcache *avc, } else { afs_warn("BYPASS: StartRXAFS_FetchData failed: %d\n", code); unlock_and_release_pages(auio); - afs_PutConn(tc, rxconn, SHARED_LOCK); + (void)afs_Analyze(tc, rxconn, code, &avc->f.fid, areq, + AFS_STATS_FS_RPCIDX_FETCHDATA, + SHARED_LOCK, NULL); goto done; } if (code == 0) { @@ -629,6 +631,9 @@ afs_PrefetchNoCache(struct vcache *avc, afs_warn("BYPASS: No connection.\n"); code = -1; unlock_and_release_pages(auio); + (void)afs_Analyze(tc, rxconn, code, &avc->f.fid, areq, + AFS_STATS_FS_RPCIDX_FETCHDATA, + SHARED_LOCK, NULL); goto done; } } while (afs_Analyze(tc, rxconn, code, &avc->f.fid, areq, diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index dc0f928ac..3d69091f5 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -2477,13 +2477,18 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte, ReleaseWriteLock(&tdc->lock); afs_PutDCache(tdc); tdc = 0; - ReleaseReadLock(&avc->lock); - if (tc) { - /* If we have a connection, we must put it back, - * since afs_Analyze will not be called here. */ - afs_PutConn(tc, rxconn, SHARED_LOCK); - } + /* + * Call afs_Analyze to manage the connection references + * and handle the error code (possibly mark servers + * down, etc). We are going to retry getting the + * dcache regardless, so we just ignore the retry hint + * returned by afs_Analyze on this call. + */ + (void)afs_Analyze(tc, rxconn, code, &avc->f.fid, areq, + AFS_STATS_FS_RPCIDX_FETCHDATA, SHARED_LOCK, NULL); + + ReleaseReadLock(&avc->lock); slowPass = 1; goto RetryGetDCache;