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)
committerMichael Adam <obnox@samba.org>
Fri, 26 Apr 2013 14:02:10 +0000 (16:02 +0200)
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>
(cherry picked from commit e72a5e11845fe445baaee4730bb0bea8588ee9e3)

client/ctdb_client.c

index 94fc712972082bd8a403e618fc658b1701ee7f0c..c1b79af5eaf3a777d79087bebbd80e43e751a0f0 100644 (file)
@@ -926,6 +926,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);
 }