mirror of
https://github.com/samba-team/samba.git
synced 2025-03-12 20:58:37 +03:00
ctdb-daemon: Simplify ctdb_control_modflags()
Now that there are separate disable/enable controls used by the ctdb tool this control can ignore any flag updates for the current nodes. These only come from the recovery master, which depends on being able to fetch flags for all nodes. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit ae10a8a4b70e53ea3be6257d1f86f2d9a56aa62a)
This commit is contained in:
parent
f340dcbc67
commit
665b380d24
@ -455,34 +455,35 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
|
||||
struct ctdb_node *node;
|
||||
uint32_t old_flags;
|
||||
|
||||
if (c->pnn >= ctdb->num_nodes) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " Node %d is invalid, num_nodes :%d\n", c->pnn, ctdb->num_nodes));
|
||||
/*
|
||||
* Don't let other nodes override the current node's flags.
|
||||
* The recovery master fetches flags from this node so there's
|
||||
* no need to push them back. Doing so is racy.
|
||||
*/
|
||||
if (c->pnn == ctdb->pnn) {
|
||||
DBG_DEBUG("Ignoring flag changes for current node\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
node = ctdb_find_node(ctdb, c->pnn);
|
||||
if (node == NULL) {
|
||||
DBG_ERR("Node %u is invalid\n", c->pnn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
node = ctdb->nodes[c->pnn];
|
||||
old_flags = node->flags;
|
||||
if (c->pnn != ctdb->pnn) {
|
||||
c->old_flags = node->flags;
|
||||
}
|
||||
node->flags = c->new_flags & ~NODE_FLAGS_DISCONNECTED;
|
||||
node->flags |= (c->old_flags & NODE_FLAGS_DISCONNECTED);
|
||||
/*
|
||||
* Remember the old flags. We don't care what some other node
|
||||
* thought the old flags were - that's irrelevant.
|
||||
*/
|
||||
old_flags = node->flags;
|
||||
|
||||
/* we don't let other nodes modify our STOPPED status */
|
||||
if (c->pnn == ctdb->pnn) {
|
||||
node->flags &= ~NODE_FLAGS_STOPPED;
|
||||
if (old_flags & NODE_FLAGS_STOPPED) {
|
||||
node->flags |= NODE_FLAGS_STOPPED;
|
||||
}
|
||||
}
|
||||
|
||||
/* we don't let other nodes modify our BANNED status */
|
||||
if (c->pnn == ctdb->pnn) {
|
||||
node->flags &= ~NODE_FLAGS_BANNED;
|
||||
if (old_flags & NODE_FLAGS_BANNED) {
|
||||
node->flags |= NODE_FLAGS_BANNED;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This node tracks nodes it is connected to, so don't let
|
||||
* another node override this
|
||||
*/
|
||||
node->flags =
|
||||
(old_flags & NODE_FLAGS_DISCONNECTED) |
|
||||
(c->new_flags & ~NODE_FLAGS_DISCONNECTED);
|
||||
|
||||
if (node->flags == old_flags) {
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user