]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: make sure to call afs_Analyze after afs_Conn
authorMichael Meffie <mmeffie@sinenomine.net>
Fri, 16 Mar 2018 14:25:18 +0000 (09:25 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Mon, 10 Jun 2019 11:40:32 +0000 (07:40 -0400)
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 <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 0835d7c2a183f896096684df06258aefd297f080)

Change-Id: Ic5648dbd250c33988d64284b906b3829a396a2cb
Reviewed-on: https://gerrit.openafs.org/13511
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/afs_bypasscache.c
src/afs/afs_dcache.c

index 847eaf0b1702f319fc2219843d1f3637fa9b62e8..64da1ed19fbd344e420978d9ec14597e2d699ee2 100644 (file)
@@ -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,
index dc0f928ac50616726f062edb45d0e5a39018a6ca..3d69091f536d3cb1a7f5ed904dfbabe76ddaa7e9 100644 (file)
@@ -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;