ctdb-recovery: Don't store recmode in recovery mode state
authorMartin Schwenke <martin@meltin.net>
Mon, 11 Jan 2016 02:58:54 +0000 (13:58 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 23 Feb 2016 06:23:18 +0000 (07:23 +0100)
The callbacks that use this value are only ever called if recovery
mode is being set to NORMAL.  So do not check if recmode is NORMAL
either.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recover.c

index 7411dd26a1d1cd132faab7360affc108f971172d..4e6171ab1b38ff5cdbec9a36d94487b24294a8fb 100644 (file)
@@ -410,7 +410,6 @@ failed:
 struct ctdb_set_recmode_state {
        struct ctdb_context *ctdb;
        struct ctdb_req_control_old *c;
-       uint32_t recmode;
        int fd[2];
        struct tevent_timer *te;
        struct tevent_fd *fde;
@@ -435,7 +434,7 @@ static void ctdb_set_recmode_timeout(struct tevent_context *ev,
           arbitrate locks immediately after a node failure.       
         */
        DEBUG(DEBUG_ERR,(__location__ " set_recmode child process hung/timedout CFS slow to grant locks? (allowing recmode set anyway)\n"));
-       state->ctdb->recovery_mode = state->recmode;
+       state->ctdb->recovery_mode = CTDB_RECOVERY_NORMAL;
        ctdb_request_control_reply(state->ctdb, state->c, NULL, 0, NULL);
        talloc_free(state);
 }
@@ -493,12 +492,10 @@ static void set_recmode_handler(struct tevent_context *ev,
                return;
        }
 
-       state->ctdb->recovery_mode = state->recmode;
+       state->ctdb->recovery_mode = CTDB_RECOVERY_NORMAL;
 
        /* release any deferred attach calls from clients */
-       if (state->recmode == CTDB_RECOVERY_NORMAL) {
-               ctdb_process_deferred_attach(state->ctdb);
-       }
+       ctdb_process_deferred_attach(state->ctdb);
 
        ctdb_request_control_reply(state->ctdb, state->c, NULL, 0, NULL);
        talloc_free(state);
@@ -573,7 +570,10 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
                return 0;
        }
 
-       /* some special handling when ending recovery mode */
+       /* From this point: recmode == CTDB_RECOVERY_NORMAL
+        *
+        * Therefore, what follows is special handling when setting
+        * recovery mode back to normal */
 
        for (ctdb_db = ctdb->db_list; ctdb_db != NULL; ctdb_db = ctdb_db->next) {
                if (ctdb_db->generation != ctdb->vnn_map->generation) {
@@ -672,7 +672,6 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
        tevent_fd_set_auto_close(state->fde);
 
        state->ctdb    = ctdb;
-       state->recmode = recmode;
        state->c       = talloc_steal(state, c);
 
        *async_reply = true;