From f57d379446c551bca5906247c622e857c77089b0 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Thu, 7 Sep 2017 17:21:03 +1000 Subject: [PATCH] ctdb-daemon: GET_DB_SEQNUM should read database conditionally BUG: https://bugzilla.samba.org/show_bug.cgi?id=13021 Once the recovery starts and databases are frozen, then all the record access is postponed till the recovery is complete except reading the database sequence number. Database access for reading sequence number is done via a control which does not check if the databases are frozen or not. If the database is frozen and if the freeze transaction is not started (this can happen when a node is inactive, or during recovery when the database is frozen but the transaction has not yet started), then trying to read sequence number will cause ctdb daemon to deadlock. Before reading the sequence number, check if the database access is allowed. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/server/ctdb_persistent.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ctdb/server/ctdb_persistent.c b/ctdb/server/ctdb_persistent.c index 1811ae8fa66a..fc2865527474 100644 --- a/ctdb/server/ctdb_persistent.c +++ b/ctdb/server/ctdb_persistent.c @@ -344,6 +344,11 @@ static int32_t ctdb_get_db_seqnum(struct ctdb_context *ctdb, goto done; } + if (! ctdb_db_allow_access(ctdb_db)) { + ret = -1; + goto done; + } + key.dptr = (uint8_t *)discard_const(keyname); key.dsize = strlen(keyname) + 1; -- 2.34.1