freeze: Make ctdb_start_freeze() a void function
authorAmitay Isaacs <amitay@gmail.com>
Mon, 1 Jul 2013 06:28:04 +0000 (16:28 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 2 Jul 2013 07:44:17 +0000 (17:44 +1000)
If this function fails due to memory errors, there is no way to recover.
The best course of action is to abort.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 46efe7a886f8c4c56f19536adc98a73c22db906a)

Conflicts:
server/ctdb_freeze.c

include/ctdb_private.h
server/ctdb_banning.c
server/ctdb_freeze.c

index faea6ca50edced460dc21f9f0c3f171770c62e32..85b6f3193cc00b56cfdaa92215981cfb1876500a 100644 (file)
@@ -1206,7 +1206,7 @@ int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
                               uint32_t destnode,
                               struct ctdb_tunable *tunables);
 
-int ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority);
+void ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority);
 
 bool parse_ip_mask(const char *s, const char *iface, ctdb_sock_addr *addr, unsigned *mask);
 bool parse_ip_port(const char *s, ctdb_sock_addr *addr);
index 56849072d72f62c5a5b004aabeaf1ece7a03c049..fc2db5cb799990034c13dfc4ab021dc04a80bfc5 100644 (file)
@@ -57,9 +57,7 @@ int32_t ctdb_local_node_got_banned(struct ctdb_context *ctdb)
        ctdb->vnn_map->generation = INVALID_GENERATION;
 
        for (i=1; i<=NUM_DB_PRIORITIES; i++) {
-               if (ctdb_start_freeze(ctdb, i) != 0) {
-                       DEBUG(DEBUG_ERR,(__location__ " Failed to freeze db priority %u\n", i));
-               }
+               ctdb_start_freeze(ctdb, i);
        }
        ctdb_release_all_ips(ctdb);
        ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
index b209b0e0d1b22e1eabd79cfcfd01e23f029ba31c..8f87de8738591c47fa13d2e9d86fd83835489403 100644 (file)
@@ -278,7 +278,7 @@ static void ctdb_debug_locks(void)
 /*
   start the freeze process for a certain priority
  */
-int ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority)
+void ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority)
 {
        if ((priority < 1) || (priority > NUM_DB_PRIORITIES)) {
                DEBUG(DEBUG_ERR,(__location__ " Invalid db priority : %u\n", priority));
@@ -287,7 +287,7 @@ int ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority)
 
        if (ctdb->freeze_mode[priority] == CTDB_FREEZE_FROZEN) {
                /* we're already frozen */
-               return 0;
+               return;
        }
 
        DEBUG(DEBUG_ERR, ("Freeze priority %u\n", priority));
@@ -298,15 +298,13 @@ int ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority)
        /* if there isn't a freeze lock child then create one */
        if (ctdb->freeze_handles[priority] == NULL) {
                ctdb->freeze_handles[priority] = ctdb_freeze_lock(ctdb, priority);
-               CTDB_NO_MEMORY(ctdb, ctdb->freeze_handles[priority]);
+               CTDB_NO_MEMORY_FATAL(ctdb, ctdb->freeze_handles[priority]);
                ctdb->freeze_mode[priority] = CTDB_FREEZE_PENDING;
        } else {
                /* The previous free lock child has not yet been able to get locks.
                 * Invoke debugging script */
                ctdb_debug_locks();
        }
-
-       return 0;
 }
 
 /*
@@ -335,10 +333,7 @@ int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *
                return 0;
        }
 
-       if (ctdb_start_freeze(ctdb, priority) != 0) {
-               DEBUG(DEBUG_ERR,(__location__ " Failed to start freezing databases with priority %u\n", priority));
-               return -1;
-       }
+       ctdb_start_freeze(ctdb, priority);
 
        /* add ourselves to list of waiters */
        if (ctdb->freeze_handles[priority] == NULL) {
@@ -369,10 +364,7 @@ bool ctdb_blocking_freeze(struct ctdb_context *ctdb)
        int i;
 
        for (i=1; i<=NUM_DB_PRIORITIES; i++) {
-               if (ctdb_start_freeze(ctdb, i)) {
-                       DEBUG(DEBUG_ERR,(__location__ " Failed to freeze databases of prio %u\n", i));
-                       continue;
-               }
+               ctdb_start_freeze(ctdb, i);
 
                /* block until frozen */
                while (ctdb->freeze_mode[i] == CTDB_FREEZE_PENDING) {