From e3b6d1e511b03d03219b6c21312a902ff848fe5b Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 22 Aug 2007 11:34:48 +1000 Subject: [PATCH] if the node is inactive i.e. banned or disconnected then that node is not participating in the cluster if a client tries to attach to a database while the node is inactive, return an error back to the client and fail the attach (This used to be ctdb commit b26949f3c8e54f3bc60da04d7b4ac69f301068fc) --- ctdb/server/ctdb_ltdb_server.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index bd07f674db9..d1e83a5fefb 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -194,8 +194,19 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, { const char *db_name = (const char *)indata.dptr; struct ctdb_db_context *ctdb_db, *tmp_db; + struct ctdb_node *node = ctdb->nodes[ctdb->vnn]; int ret; + /* If the node is inactive it is not part of the cluster + and we should not allow clients to attach to any + databases + */ + if (node->flags & NODE_FLAGS_INACTIVE) { + DEBUG(0,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name)); + return -1; + } + + /* see if we already have this name */ for (tmp_db=ctdb->db_list;tmp_db;tmp_db=tmp_db->next) { if (strcmp(db_name, tmp_db->db_name) == 0) { -- 2.47.3