]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-recoverd: Set recovery lock handle at start of attempt
authorMartin Schwenke <martin@meltin.net>
Mon, 3 Sep 2018 03:30:57 +0000 (13:30 +1000)
committerKarolin Seeger <kseeger@samba.org>
Thu, 20 Sep 2018 12:05:59 +0000 (14:05 +0200)
This allows the attempt to be cancelled if an election is lost and an
unlock is done before the attempt is completed.

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>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Sep 18 02:18:30 CEST 2018 on sn-devel-144

(cherry picked from commit 486022ef8f43251258f255ffa15f1a01bc6aa2b7)

Autobuild-User(v4-8-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-8-test): Thu Sep 20 14:05:59 CEST 2018 on sn-devel-144

ctdb/server/ctdb_recoverd.c

index 5e49e8842d997efb620b71c6f3aa16e03237d5bf..62e4c4655da1f79b4fa6cba041089a4ec6b10eae 100644 (file)
@@ -954,17 +954,18 @@ static bool ctdb_recovery_lock(struct ctdb_recoverd *rec)
                return false;
        }
 
+       rec->recovery_lock_handle = s;
+       s->h = h;
+
        while (! s->done) {
                tevent_loop_once(ctdb->ev);
        }
 
        if (! s->locked) {
-               talloc_free(s);
+               TALLOC_FREE(rec->recovery_lock_handle);
                return false;
        }
 
-       rec->recovery_lock_handle = s;
-       s->h = h;
        ctdb_ctrl_report_recd_lock_latency(ctdb,
                                           CONTROL_TIMEOUT(),
                                           s->latency);