From: Andrew Deason Date: Fri, 17 Feb 2012 21:46:50 +0000 (-0600) Subject: viced: Set h_GetHost_r probefail if MPAA_r fails X-Git-Tag: upstream/1.6.1.pre4^2~55 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=dbaaa4c8f9cc1f2d8400b41a43009a0433544e0f;p=packages%2Fo%2Fopenafs.git viced: Set h_GetHost_r probefail if MPAA_r fails Currently, in h_GetHost_r, if we get a connection whose address does not match an extant host, but the reported uuid does, we ProbeUuid the old host. If it fails, we call MultiProbeAlternateAddress_r and set 'probefail'. Later on, if 'probefail' is set, we always add the connection address to the host, and remove the host->host,host->port address from the host. However, this is not always correct. Consider the following situation. We have an existing host that has primary address 1.1.1.1, and also has addresses 1.1.1.2 and 1.1.1.3 on the interface list but not on the hash table. Say that host A stops responding on 1.1.1.1, and a connection comes in from 1.1.1.2. We ProbeUuid 1.1.1.1 and get a failure, so we call MultiProbeAlternateAddress_r. MultiProbeAlternateAddress_r probes via rx_Multi the addresses 1.1.1.2 and 1.1.1.3. Say that 1.1.1.3 responds first, and responds successfully, so MultiProbeAlternateAddress_r sets 1.1.1.3 to be the primary address for the host. After MultiProbeAlternateAddress_r returns, 'probefail' is set. A few lines down, we see that oldHost->host does not match haddr, and 'probefail' is set, so we add 1.1.1.2 to the interface list, and remove 1.1.1.3, and set 1.1.1.2 to be the primary address, even though 1.1.1.3 is the address we most recently 'know' is correct. To fix this, only set 'probefail' if MultiProbeAlternateAddress_r also fails after the failed ProbeUuid call. Conceptually this makes sense, since if MultiProbeAlternateAddress_r succeeds, it found an address that responds successfully to ProbeUuid, and it sets that address to be the primary address. Therefore, after MultiProbeAlternateAddress_r returns success, the situation is the same as if the 'good' address was already the primary address, and the ProbeUuid call succeeded, so 'probefail' should be cleared. Reviewed-on: http://gerrit.openafs.org/6728 Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear Reviewed-by: Alistair Ferguson Tested-by: BuildBot (cherry picked from commit 3c803580bb503c7650f7b138c1b3f2eafd92b985) Change-Id: I6554688447e7e62874e45a00a4c1faf957e29cb6 Reviewed-on: http://gerrit.openafs.org/6768 Tested-by: BuildBot Reviewed-by: Alistair Ferguson Reviewed-by: Derrick Brashear --- diff --git a/src/viced/host.c b/src/viced/host.c index 168cf4b71..9f89688c3 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -2095,8 +2095,17 @@ h_GetHost_r(struct rx_connection *tcon) oldHost, afs_inet_ntoa_r(oldHost->host, hoststr), ntohs(oldHost->port),code2)); - MultiProbeAlternateAddress_r(oldHost); - probefail = 1; + + if (MultiProbeAlternateAddress_r(oldHost)) { + /* If MultiProbeAlternateAddress_r succeeded, + * it updated oldHost->host and oldHost->port + * to an address that responded successfully to + * a ProbeUuid, so it is as if the ProbeUuid + * call above returned success. So, only set + * 'probefail' if MultiProbeAlternateAddress_r + * fails. */ + probefail = 1; + } } } else { probefail = 1;