diff options
author | Martin Schwenke <martin@meltin.net> | 2015-07-24 15:32:42 +1000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2015-08-17 18:09:40 +0200 |
commit | d0c48632d2268ac2978f3ceca0e5215e06d17d25 (patch) | |
tree | 047a554ed0cacfb90bc1c0edda9c49e7091fed2f | |
parent | 3c7f3e7b989b1bae03c2f6de18b6359f2f6e313e (diff) | |
download | samba-d0c48632d2268ac2978f3ceca0e5215e06d17d25.tar.gz |
ctdb-daemon: Check if updates are in flight when releasing all IPs
Some code involved in releasing IPs is not re-entrant. Memory
corruption can occur if, for example, overlapping attempts are made to
ban a node. We haven't been able to recreate the corruption but this
should protect against it.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11432
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 952a50485f68b3cffdf57da84aa9bb9fde630b7e)
-rw-r--r-- | ctdb/server/ctdb_takeover.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index d5d2b39e4d8..efc80b1ab8c 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -3128,9 +3128,6 @@ void ctdb_takeover_client_destructor_hook(struct ctdb_client *client) } -/* - release all IPs on shutdown - */ void ctdb_release_all_ips(struct ctdb_context *ctdb) { struct ctdb_vnn *vnn; @@ -3149,6 +3146,20 @@ void ctdb_release_all_ips(struct ctdb_context *ctdb) continue; } + /* Don't allow multiple releases at once. Some code, + * particularly ctdb_tickle_sentenced_connections() is + * not re-entrant */ + if (vnn->update_in_flight) { + DEBUG(DEBUG_WARNING, + (__location__ + " Not releasing IP %s/%u on interface %s, an update is already in progess\n", + ctdb_addr_to_str(&vnn->public_address), + vnn->public_netmask_bits, + ctdb_vnn_iface_string(vnn))); + continue; + } + vnn->update_in_flight = true; + DEBUG(DEBUG_INFO,("Release of IP %s/%u on interface %s node:-1\n", ctdb_addr_to_str(&vnn->public_address), vnn->public_netmask_bits, @@ -3160,6 +3171,7 @@ void ctdb_release_all_ips(struct ctdb_context *ctdb) vnn->public_netmask_bits); release_kill_clients(ctdb, &vnn->public_address); ctdb_vnn_unassign_iface(ctdb, vnn); + vnn->update_in_flight = false; count++; } |