]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-client: Reimplement ctdb_ctrl_freeze_priority() using ctdb_control()
authorAmitay Isaacs <amitay@gmail.com>
Thu, 21 Jul 2016 02:47:16 +0000 (12:47 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 25 Jul 2016 19:29:41 +0000 (21:29 +0200)
This makes it easier to drop unused async implementation of the same.

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

index d1b622574ea5e7316941e72b057898cbe51eca2b..80f6b2affbef9156ceff124d74cfe03853fd80d4 100644 (file)
@@ -2459,17 +2459,22 @@ int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct
 /*
   freeze databases of a certain priority
  */
-int ctdb_ctrl_freeze_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t priority)
+int ctdb_ctrl_freeze_priority(struct ctdb_context *ctdb,
+                             struct timeval timeout,
+                             uint32_t destnode, uint32_t priority)
 {
-       TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
-       struct ctdb_client_control_state *state;
        int ret;
+       int32_t res;
 
-       state = ctdb_ctrl_freeze_send(ctdb, tmp_ctx, timeout, destnode, priority);
-       ret = ctdb_ctrl_freeze_recv(ctdb, tmp_ctx, state);
-       talloc_free(tmp_ctx);
+       ret = ctdb_control(ctdb, destnode, priority,
+                          CTDB_CONTROL_FREEZE, 0, tdb_null,
+                          NULL, NULL, &res, &timeout, NULL);
+       if (ret != 0 || res != 0) {
+               DEBUG(DEBUG_ERR, ("ctdb_ctrl_freeze_priority failed\n"));
+               return -1;
+       }
 
-       return ret;
+       return 0;
 }
 
 /* Freeze all databases */