From: Amitay Isaacs Date: Thu, 22 Jun 2017 04:09:32 +0000 (+1000) Subject: ctdb-recovery: Finish processing for recovery mode ACTIVE first X-Git-Tag: samba-4.5.11~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10a763dd1b8917105200edb2161e3c42da86c799;p=thirdparty%2Fsamba.git ctdb-recovery: Finish processing for recovery mode ACTIVE first BUG: https://bugzilla.samba.org/show_bug.cgi?id=12857 This simplifies the code and avoids complicated conditions. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit f8200153b21f5b19c9a1d57be3e05e739d9fafcd) --- diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c index 08eb5c9fef1..ea8a0b3c117 100644 --- a/ctdb/server/ctdb_recover.c +++ b/ctdb/server/ctdb_recover.c @@ -870,18 +870,13 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb, /* if we enter recovery but stay in recovery for too long we will eventually drop all our ip addresses */ - if (recmode == CTDB_RECOVERY_NORMAL) { - talloc_free(ctdb->release_ips_ctx); - ctdb->release_ips_ctx = NULL; - } else { + if (recmode == CTDB_RECOVERY_ACTIVE) { if (ctdb_deferred_drop_all_ips(ctdb) != 0) { - DEBUG(DEBUG_ERR,("Failed to set up deferred drop all ips\n")); + DEBUG(DEBUG_ERR, + ("Failed to set up deferred drop all ips\n")); } - } - if (recmode != CTDB_RECOVERY_NORMAL || - ctdb->recovery_mode != CTDB_RECOVERY_ACTIVE) { - ctdb->recovery_mode = recmode; + ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE; return 0; } @@ -890,6 +885,8 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb, * Therefore, what follows is special handling when setting * recovery mode back to normal */ + TALLOC_FREE(ctdb->release_ips_ctx); + for (ctdb_db = ctdb->db_list; ctdb_db != NULL; ctdb_db = ctdb_db->next) { if (ctdb_db->generation != ctdb->vnn_map->generation) { DEBUG(DEBUG_ERR,