client: fix ctdb_control() to be able to cope with CTDB_CTRL_FLAG_NOREPLY
authorMichael Adam <obnox@samba.org>
Mon, 22 Apr 2013 14:21:02 +0000 (10:21 -0400)
committerAmitay Isaacs <amitay@gmail.com>
Wed, 24 Apr 2013 08:46:22 +0000 (18:46 +1000)
This was apparently not used before in this context, and the bug hence
not detected. It becomes necessary when ctdb_local_schedule_for_deletion()
is called from a client ctdbd (the vacuuming child), hence needs to send
the SCHEDULE_FOR_DELETION control to its parent.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>
client/ctdb_client.c

index 76780b0b5abab34ee2c91bca0ec501bd4d896671..2ae89582f5500efb7708c85e83886318b3d64de7 100644 (file)
@@ -1140,6 +1140,17 @@ int ctdb_control(struct ctdb_context *ctdb, uint32_t destnode, uint64_t srvid,
        state = ctdb_control_send(ctdb, destnode, srvid, opcode, 
                        flags, data, mem_ctx,
                        timeout, errormsg);
+
+       /* FIXME: Error conditions in ctdb_control_send return NULL without
+        * setting errormsg.  So, there is no way to distinguish between sucess
+        * and failure when CTDB_CTRL_FLAG_NOREPLY is set */
+       if (flags & CTDB_CTRL_FLAG_NOREPLY) {
+               if (status != NULL) {
+                       *status = 0;
+               }
+               return 0;
+       }
+
        return ctdb_control_recv(ctdb, state, mem_ctx, outdata, status, 
                        errormsg);
 }