From: Martin Schwenke Date: Thu, 20 Feb 2020 02:48:13 +0000 (+1100) Subject: ctdb-daemon: Fix database attach deferral logic X-Git-Tag: samba-4.12.1~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9fa4fb05755eb5083a1ec28035b1105a9e90b4f;p=thirdparty%2Fsamba.git ctdb-daemon: Fix database attach deferral logic Commit 3cc230b5eeca749ab68d19cfda969f72c269f1f6 says: Dont allow clients to connect to databases untile we are well past and through the initial recovery phase It is unclear what this commit was attempting to do. The commit message implies that more attaches should be deferred but the code change adds a conjunction that causes less attaches to be deferred. In particular, no attaches will be deferred after startup is complete. This seems wrong. To implement what seems to be stated in the commit message an "or" needs to be used so that non-recovery daemon attaches are deferred either when in recovery or before startup is complete. Making this change highlights that attaches need to be allowed during the "startup" event because this is when smbd is started. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs (cherry picked from commit c6c89495fbe9b6f238d10a538eccc92b937a69de) --- diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index 970eb54b00b..a6709ff72de 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -1135,9 +1135,9 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, return -1; } - if (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE && - client->pid != ctdb->recoverd_pid && - ctdb->runstate < CTDB_RUNSTATE_RUNNING) { + if (client->pid != ctdb->recoverd_pid && + (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE || + ctdb->runstate < CTDB_RUNSTATE_STARTUP)) { struct ctdb_deferred_attach_context *da_ctx = talloc(client, struct ctdb_deferred_attach_context); if (da_ctx == NULL) {