From a6ad67485bf23084c06e1de1a424b2e375ee70f3 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Tue, 11 Jul 2017 08:51:08 -0400 Subject: [PATCH] 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 --- src/afs/afs_conn.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/afs/afs_conn.c b/src/afs/afs_conn.c index be6ab2bbf..56515c8c3 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; -- 2.39.5