server:trans2_commit: move the check for active recovery down.
authorMichael Adam <obnox@samba.org>
Thu, 3 Dec 2009 23:06:34 +0000 (00:06 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 4 Dec 2009 14:03:21 +0000 (15:03 +0100)
This needs to be done after the control-dispatcher:
In the TRANS2_COMMIT control, the client->db_id needs
to be set before bailing out, since otherwise the
next TRANS2_COMMIT_RETRY will fail...

Michael

server/ctdb_persistent.c

index 02ca7c8d9ca7fb3128fb47bb9aeec346c5010cbb..7fc45877f3bd0c5b09c79a182c5890a410f03f0f 100644 (file)
@@ -105,11 +105,6 @@ int32_t ctdb_control_trans2_commit(struct ctdb_context *ctdb,
        struct ctdb_marshall_buffer *m = (struct ctdb_marshall_buffer *)recdata.dptr;
        struct ctdb_db_context *ctdb_db;
 
-       if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
-               DEBUG(DEBUG_INFO,("rejecting ctdb_control_trans2_commit when recovery active\n"));
-               return -1;
-       }
-
        ctdb_db = find_ctdb_db(ctdb, m->db_id);
        if (ctdb_db == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_control_trans2_commit: "
@@ -189,6 +184,11 @@ int32_t ctdb_control_trans2_commit(struct ctdb_context *ctdb,
                break;
        }
 
+       if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
+               DEBUG(DEBUG_INFO,("rejecting ctdb_control_trans2_commit when recovery active\n"));
+               return -1;
+       }
+
        state = talloc_zero(ctdb, struct ctdb_persistent_state);
        CTDB_NO_MEMORY(ctdb, state);