From: Martin Schwenke Date: Thu, 18 Jan 2018 05:19:36 +0000 (+1100) Subject: ctdb-recoverd: Basic cleanups for get_remote_nodemaps() X-Git-Tag: talloc-2.3.2~837 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52f520d39cd92e1cf2413fd7e0dd362debd6f463;p=thirdparty%2Fsamba.git ctdb-recoverd: Basic cleanups for get_remote_nodemaps() Don't log an error on failure - let the caller can do this. Apart from this: fix up coding style and modernise the remaining error message. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 3f72619127a..41f029e6bca 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -2223,38 +2223,45 @@ done: } -static void async_getnodemap_callback(struct ctdb_context *ctdb, uint32_t node_pnn, int32_t res, TDB_DATA outdata, void *callback_data) +static void async_getnodemap_callback(struct ctdb_context *ctdb, + uint32_t node_pnn, + int32_t res, + TDB_DATA outdata, + void *callback_data) { struct ctdb_node_map_old **remote_nodemaps = callback_data; if (node_pnn >= ctdb->num_nodes) { - DEBUG(DEBUG_ERR,(__location__ " pnn from invalid node\n")); + DBG_ERR("Invalid PNN\n"); return; } - remote_nodemaps[node_pnn] = (struct ctdb_node_map_old *)talloc_steal(remote_nodemaps, outdata.dptr); + remote_nodemaps[node_pnn] = (struct ctdb_node_map_old *)talloc_steal( + remote_nodemaps, outdata.dptr); } -static int get_remote_nodemaps(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, - struct ctdb_node_map_old *nodemap, - struct ctdb_node_map_old **remote_nodemaps) +static int get_remote_nodemaps(struct ctdb_context *ctdb, + TALLOC_CTX *mem_ctx, + struct ctdb_node_map_old *nodemap, + struct ctdb_node_map_old **remote_nodemaps) { uint32_t *nodes; + int ret; nodes = list_of_active_nodes(ctdb, nodemap, mem_ctx, true); - if (ctdb_client_async_control(ctdb, CTDB_CONTROL_GET_NODEMAP, - nodes, 0, - CONTROL_TIMEOUT(), false, tdb_null, + + ret = ctdb_client_async_control(ctdb, + CTDB_CONTROL_GET_NODEMAP, + nodes, + 0, + CONTROL_TIMEOUT(), + false, + tdb_null, async_getnodemap_callback, NULL, - remote_nodemaps) != 0) { - DEBUG(DEBUG_ERR, (__location__ " Unable to pull all remote nodemaps\n")); - - return -1; - } - - return 0; + remote_nodemaps); + return ret; } static bool validate_recovery_master(struct ctdb_recoverd *rec,