]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced: add then remove when changing addresses
authorMichael Meffie <mmeffie@sinenomine.net>
Wed, 23 Dec 2009 21:38:57 +0000 (16:38 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Wed, 30 Dec 2009 02:24:17 +0000 (18:24 -0800)
When changing a host address, be sure to add the new interface
before removing the old to avoid having the host marked as
deleted if we removed the only valid address.  This change was
pulled out of commit ca613599a2537756462a420ae1a632747a433226
viced-host-uuid-and-addr-hashing-corrections-20090530 by
Jeffrey Altman.

LICENSE IPL10
FIXES 124634

Change-Id: Ie65e762c4be6205eb654566403f0d5088b7ebdee
Reviewed-on: http://gerrit.openafs.org/1026
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/viced/host.c

index 153e6baf90711902fca7bb868ce625b94b0f7c7f..60d1a6cbe1fa36c3024acb8692472fca8607b42c 100644 (file)
@@ -1629,9 +1629,13 @@ h_GetHost_r(struct rx_connection *tcon, int *heldp)
                               host, 
                               afs_inet_ntoa_r(host->host, hoststr),
                               ntohs(host->port),code2));
-                   
-                    removeInterfaceAddr_r(host, host->host, host->port);
+                   /*
+                    * make sure we add and then remove. otherwise, we
+                    * might end up with no valid interfaces after the
+                    * remove and the host will have been marked deleted.
+                    */
                     addInterfaceAddr_r(host, haddr, hport);
+                    removeInterfaceAddr_r(host, host->host, host->port);
                     host->host = haddr;
                     host->port = hport;
                     rxconn = host->callback_rxcon;
@@ -1870,6 +1874,11 @@ h_GetHost_r(struct rx_connection *tcon, int *heldp)
                                  ntohs(oldHost->port),
                                   afs_inet_ntoa_r(haddr, hoststr),
                                  ntohs(hport)));
+                       /*
+                        * add then remove.  otherwise the host may get marked
+                        * deleted if we removed the only valid address.
+                        */
+                       addInterfaceAddr_r(oldHost, haddr, hport);
                        if (probefail || oldHost->host == haddr) {
                            /* The probe failed which means that the old address is 
                             * either unreachable or is not the same host we were just
@@ -1896,7 +1905,6 @@ h_GetHost_r(struct rx_connection *tcon, int *heldp)
                                removeInterfaceAddr_r(oldHost, haddr, interface->interface[i].port);
                            }
                        }
-                       addInterfaceAddr_r(oldHost, haddr, hport);
                         hashInsert_r(haddr, hport, oldHost);
                        oldHost->host = haddr;
                        oldHost->port = hport;