summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-09-03 13:01:19 +1000
committerKarolin Seeger <kseeger@samba.org>2018-09-20 09:11:20 +0200
commite6bcccbca29a98af134a5f9e3ef620ef48411240 (patch)
treee16bf74d3b0d9e7d331fc6094a25f4fef22ce28d /ctdb
parenta9c7c64116ad0031aa132bceee08cec9adc37ad8 (diff)
downloadsamba-e6bcccbca29a98af134a5f9e3ef620ef48411240.tar.gz
ctdb-recoverd: Handle cancellation when releasing recovery lock
If the recovery lock is in the process of being taken then free the cluster mutex handle but leave the recovery lock handle in place. This allows ctdb_recovery_lock() to fail. Note that this isn't yet live because rec->recovery_lock_handle is still only set at the completion of the attempt to take the lock. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13617 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit b1dc5687844e90b0e3c39cb46a1116c86118fbf4)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/ctdb_recoverd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 6a021101535..d0eceee62f9 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -980,6 +980,20 @@ static void ctdb_recovery_unlock(struct ctdb_recoverd *rec)
return;
}
+ if (! rec->recovery_lock_handle->done) {
+ /*
+ * Taking of recovery lock still in progress. Free
+ * the cluster mutex handle to release it but leave
+ * the recovery lock handle in place to allow taking
+ * of the lock to fail.
+ */
+ D_NOTICE("Cancelling recovery lock\n");
+ TALLOC_FREE(rec->recovery_lock_handle->h);
+ rec->recovery_lock_handle->done = true;
+ rec->recovery_lock_handle->locked = false;
+ return;
+ }
+
D_NOTICE("Releasing recovery lock\n");
TALLOC_FREE(rec->recovery_lock_handle);
}