From: Michael Meffie Date: Tue, 11 Jul 2017 12:51:08 +0000 (-0400) Subject: afs: restore force_if_down check when getting connections X-Git-Tag: BP-openafs-stable-1_8_x~24 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=a6ad67485bf23084c06e1de1a424b2e375ee70f3 afs: restore force_if_down check when getting connections 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 Reviewed-by: Benjamin Kaduk --- diff --git a/src/afs/afs_conn.c b/src/afs/afs_conn.c index be6ab2b..56515c8 100644 --- a/src/afs/afs_conn.c +++ b/src/afs/afs_conn.c @@ -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;