]> 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)
committerMartin Schwenke <martins@samba.org>
Tue, 18 Sep 2018 00:18:30 +0000 (02:18 +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

ctdb/server/ctdb_recoverd.c

index d0eceee62f9f833a194c9804c912d0923f8e7bb4..673c99c3d341b10b808fb84b45fd007367f01a59 100644 (file)
@@ -956,17 +956,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);