mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-daemon: Factor out new function release_ip_post()
This contains the cleanup that needs to be done after an IP address is released from an interface. state->vnn is set to the return value from release_ip_post(), which is either the original VNN, or NULL if it was deleted. This allows correct handling of the in-flight flag in the destructor for state. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12158 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
e653c8bb4a
commit
46c5136e4e
@ -850,6 +850,32 @@ static void do_delete_ip(struct ctdb_context *ctdb, struct ctdb_vnn *vnn)
|
||||
talloc_free(vnn);
|
||||
}
|
||||
|
||||
static struct ctdb_vnn *release_ip_post(struct ctdb_context *ctdb,
|
||||
struct ctdb_vnn *vnn,
|
||||
ctdb_sock_addr *addr)
|
||||
{
|
||||
TDB_DATA data;
|
||||
|
||||
/* Send a message to all clients of this node telling them
|
||||
* that the cluster has been reconfigured and they should
|
||||
* close any connections on this IP address
|
||||
*/
|
||||
data.dptr = (uint8_t *)ctdb_addr_to_str(addr);
|
||||
data.dsize = strlen((char *)data.dptr)+1;
|
||||
DEBUG(DEBUG_INFO, ("Sending RELEASE_IP message for %s\n", data.dptr));
|
||||
ctdb_daemon_send_message(ctdb, ctdb->pnn, CTDB_SRVID_RELEASE_IP, data);
|
||||
|
||||
ctdb_vnn_unassign_iface(ctdb, vnn);
|
||||
|
||||
/* Process the IP if it has been marked for deletion */
|
||||
if (vnn->delete_pending) {
|
||||
do_delete_ip(ctdb, vnn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return vnn;
|
||||
}
|
||||
|
||||
/*
|
||||
called when releaseip event finishes
|
||||
*/
|
||||
@ -858,7 +884,6 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status,
|
||||
{
|
||||
struct takeover_callback_state *state =
|
||||
talloc_get_type(private_data, struct takeover_callback_state);
|
||||
TDB_DATA data;
|
||||
|
||||
if (status == -ETIME) {
|
||||
ctdb_ban_self(ctdb);
|
||||
@ -876,23 +901,7 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status,
|
||||
}
|
||||
}
|
||||
|
||||
/* send a message to all clients of this node telling them
|
||||
that the cluster has been reconfigured and they should
|
||||
release any sockets on this IP */
|
||||
data.dptr = (uint8_t *) ctdb_addr_to_str(state->addr);
|
||||
data.dsize = strlen((char *)data.dptr)+1;
|
||||
|
||||
DEBUG(DEBUG_INFO,(__location__ " sending RELEASE_IP for '%s'\n", data.dptr));
|
||||
|
||||
ctdb_daemon_send_message(ctdb, ctdb->pnn, CTDB_SRVID_RELEASE_IP, data);
|
||||
|
||||
ctdb_vnn_unassign_iface(ctdb, state->vnn);
|
||||
|
||||
/* Process the IP if it has been marked for deletion */
|
||||
if (state->vnn->delete_pending) {
|
||||
do_delete_ip(ctdb, state->vnn);
|
||||
state->vnn = NULL;
|
||||
}
|
||||
state->vnn = release_ip_post(ctdb, state->vnn, state->addr);
|
||||
|
||||
/* the control succeeded */
|
||||
ctdb_request_control_reply(ctdb, state->c, NULL, 0, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user