afs: restore force_if_down check when getting connections 53/12653/3
authorMichael Meffie <mmeffie@sinenomine.net>
Tue, 11 Jul 2017 12:51:08 +0000 (08:51 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 26 Jul 2017 01:57:33 +0000 (21:57 -0400)
Commit cb9e029255420608308127b0609179a46d9983ad removed the
force_if_down check in afs_ConnBySA, which effictively turned on
force_if_down flag for every call to afs_ConnBySA. This caused
afs_ConnBySA to always return connections, even for server addresses
marked down and force_if_down set to 0.

One serious consequence of this bug is the cache manager will retry the
preferred vlserver indefinitely when it is unreachable. This is because
the loop in afs_ConnMHosts always tries hosts in preferred order and
expects afs_ConnBySA to return a NULL if the server address has no
connections because it is marked down.

Restore the check for server addresses marked down to honor the
force_if_down flag again so we do not get connections for down servers
unless requested.

Change-Id: Ia117354929a62b0cedc218040649e9e0b8d8ed23
Reviewed-on: https://gerrit.openafs.org/12653
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/afs_conn.c

index be6ab2b..56515c8 100644 (file)
@@ -393,6 +393,11 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell,
 
     *rxconn = NULL;
 
+    if (!sap || ((sap->sa_flags & SRVR_ISDOWN) && !force_if_down)) {
+       /* sa is known down, and we don't want to force it.  */
+       return NULL;
+    }
+
     /* find cached connection */
     ObtainSharedLock(&afs_xconn, 15);
     foundvec = 0;