diff options
author | Martin Schwenke <martin@meltin.net> | 2012-08-15 15:28:14 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2012-10-10 14:54:53 +1100 |
commit | 9aa9abcc19eeb5986620d052e192ff5deea09d71 (patch) | |
tree | 340f08dbf3b94b872f401e2ce0b4e2f9a3f93da8 | |
parent | a68512c7d86da7a14a499d9d667453d8bf5fdf5b (diff) | |
download | samba-9aa9abcc19eeb5986620d052e192ff5deea09d71.tar.gz samba-9aa9abcc19eeb5986620d052e192ff5deea09d71.tar.xz samba-9aa9abcc19eeb5986620d052e192ff5deea09d71.zip |
ctdbd: Avoid unnecessary updateip event
The existing code makes one fatally bad assumption:
vnn->iface->references can never be -1 (or max-unit32_t in this case).
Right now the reference counting is broken so a reference count of -1
is possible and causes a spurious updateip when vnn->iface is the same
as best_face. This can occur frequently because we get a lot of
redundant takeovers, especially when each IP can only be hosted on one
interface.
This makes the code much more defensive by noting that when best_iface
is the same as vnn->iface there is never a need for an updateip event.
This effectively neuters the updateip code path when IPs can only be
hosted by a single interface.
This should obsolete 6a74515f0a1e24d97cee3ba05d89133aac7ad2b7.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 7054e4ded59c6b8f254dcfefaef64da05f25aecd)
-rw-r--r-- | ctdb/server/ctdb_takeover.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 775bb061d6..508e7bda99 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -645,13 +645,13 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb, } if (vnn->iface) { - if (vnn->iface->link_up) { - /* only move when the rebalance gains something */ - if (vnn->iface->references > (best_iface->references + 1)) { + if (vnn->iface != best_iface) { + if (!vnn->iface->link_up) { do_updateip = true; + } else if (vnn->iface->references > (best_iface->references + 1)) { + /* only move when the rebalance gains something */ + do_updateip = true; } - } else if (vnn->iface != best_iface) { - do_updateip = true; } } |