]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
- send tcp info to all connected nodes, not just vnnmap nodes
authorAndrew Tridgell <tridge@samba.org>
Sat, 9 Jun 2007 22:46:33 +0000 (08:46 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 9 Jun 2007 22:46:33 +0000 (08:46 +1000)
- use a non-blocking freeze when banned
- release all IPs when banned

(This used to be ctdb commit 070e85e532b33b792f85c3e72eee205d906aaf85)

ctdb/include/ctdb_private.h
ctdb/server/ctdb_daemon.c
ctdb/server/ctdb_freeze.c
ctdb/server/ctdb_monitor.c
ctdb/takeover/ctdb_takeover.c

index 989d837568c9183bc6eac7dc45e33faca642f44b..d1402725131f3925e5f7c7abc080b1edb37e1eb4 100644 (file)
@@ -1022,4 +1022,6 @@ int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
                               uint32_t destnode,
                               struct ctdb_tunable *tunables);
 
+void ctdb_start_freeze(struct ctdb_context *ctdb);
+
 #endif
index f138b9d8bc096d07ffef11758ddb390d34e813cf..a483a3a116e7f0995822dba3c9db77567bc16c2e 100644 (file)
@@ -54,6 +54,12 @@ static void flag_change_handler(struct ctdb_context *ctdb, uint64_t srvid,
                (ctdb->nodes[c->vnn]->flags&NODE_FLAGS_DISCONNECTED) 
                | (c->flags & ~NODE_FLAGS_DISCONNECTED);        
        DEBUG(2,("Node flags for node %u are now 0x%x\n", c->vnn, ctdb->nodes[c->vnn]->flags));
+
+       /* make sure we don't hold any IPs when we shouldn't */
+       if (c->vnn == ctdb->vnn &&
+           (ctdb->nodes[c->vnn]->flags & (NODE_FLAGS_INACTIVE|NODE_FLAGS_BANNED))) {
+               ctdb_release_all_ips(ctdb);
+       }
 }
 
 /* called when the "startup" event script has finished */
index 73e98d3333d41daa62ad6d7aa4a13e43dd852e11..dbc9725130e5bf99fd25fd1e24f51eebf66986cf 100644 (file)
@@ -182,23 +182,36 @@ static int ctdb_freeze_waiter_destructor(struct ctdb_freeze_waiter *w)
 }
 
 /*
-  freeze the databases
+  start the freeze process
  */
-int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *c, bool *async_reply)
+void ctdb_start_freeze(struct ctdb_context *ctdb)
 {
-       struct ctdb_freeze_waiter *w;
-
        if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
                /* we're already frozen */
-               return 0;
+               return;
        }
 
        /* if there isn't a freeze lock child then create one */
        if (!ctdb->freeze_handle) {
                ctdb->freeze_handle = ctdb_freeze_lock(ctdb);
-               CTDB_NO_MEMORY(ctdb, ctdb->freeze_handle);
+               CTDB_NO_MEMORY_VOID(ctdb, ctdb->freeze_handle);
                ctdb->freeze_mode = CTDB_FREEZE_PENDING;
        }
+}
+
+/*
+  freeze the databases
+ */
+int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *c, bool *async_reply)
+{
+       struct ctdb_freeze_waiter *w;
+
+       if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
+               /* we're already frozen */
+               return 0;
+       }
+
+       ctdb_start_freeze(ctdb);
 
        /* add ourselves to list of waiters */
        w = talloc(ctdb->freeze_handle, struct ctdb_freeze_waiter);
@@ -220,17 +233,7 @@ int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *
  */
 bool ctdb_blocking_freeze(struct ctdb_context *ctdb)
 {
-       if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
-               /* we're already frozen */
-               return true;
-       }
-
-       /* if there isn't a freeze lock child then create one */
-       if (!ctdb->freeze_handle) {
-               ctdb->freeze_handle = ctdb_freeze_lock(ctdb);
-               CTDB_NO_MEMORY(ctdb, ctdb->freeze_handle);
-               ctdb->freeze_mode = CTDB_FREEZE_PENDING;
-       }
+       ctdb_start_freeze(ctdb);
 
        /* block until frozen */
        while (ctdb->freeze_mode == CTDB_FREEZE_PENDING) {
index 73938a32b18ad99cd0e4dd1e3c80ae72553e1217..a7a61af1d7a410a1d3db192b37fbbe707380885b 100644 (file)
@@ -219,9 +219,8 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
        if ((node->flags & NODE_FLAGS_BANNED) && !(old_flags & NODE_FLAGS_BANNED)) {
                /* make sure we are frozen */
                DEBUG(0,("This node has been banned - forcing freeze and recovery\n"));
-               if (!ctdb_blocking_freeze(ctdb)) {
-                       ctdb_fatal(ctdb, "Unable to freeze when banned");
-               }
+               ctdb_start_freeze(ctdb);
+               ctdb_release_all_ips(ctdb);
                ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
        }
        
index b9fefe610fe26e095428a3eb9cd4189ba12f4ec1..a439b855ba2780671c254a418be3d6da75695a55 100644 (file)
@@ -247,7 +247,7 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status,
                        data.dptr = (uint8_t *)&t;
                        data.dsize = sizeof(t);
 
-                       ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, 
+                       ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_CONNECTED, 0, 
                                                 CTDB_CONTROL_TCP_ADD,
                                                 0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
                }
@@ -469,7 +469,6 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
 
        /* at this point ctdb->nodes[i]->takeover_vnn is the vnn which will own each IP */
 
-
        /* now tell all nodes to delete any alias that they should not
           have.  This will be a NOOP on nodes that don't currently
           hold the given alias */
@@ -557,7 +556,7 @@ int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id, u
        data.dsize = sizeof(t);
 
        /* tell all nodes about this tcp connection */
-       ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, 
+       ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_CONNECTED, 0, 
                                       CTDB_CONTROL_TCP_ADD,
                                       0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
        if (ret != 0) {
@@ -703,7 +702,7 @@ void ctdb_takeover_client_destructor_hook(struct ctdb_client *client)
                p.dest = tcp->daddr;
                data.dptr = (uint8_t *)&p;
                data.dsize = sizeof(p);
-               ctdb_daemon_send_control(client->ctdb, CTDB_BROADCAST_VNNMAP, 0, 
+               ctdb_daemon_send_control(client->ctdb, CTDB_BROADCAST_CONNECTED, 0, 
                                         CTDB_CONTROL_TCP_REMOVE,
                                         0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
                talloc_free(tcp);