]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
if the node is inactive i.e. banned or disconnected then that node is
authorRonnie Sahlberg <sahlberg@ronnie>
Wed, 22 Aug 2007 01:34:48 +0000 (11:34 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Wed, 22 Aug 2007 01:34:48 +0000 (11:34 +1000)
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

index bd07f674db9d2735c1885dbfe4fe9be57d948e44..d1e83a5fefb2546309735c6c36e424a417968602 100644 (file)
@@ -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) {