ctdb-readonly: Avoid a tight loop waiting for revoke to complete
authorAmitay Isaacs <amitay@gmail.com>
Tue, 14 Mar 2017 05:12:55 +0000 (16:12 +1100)
committerMartin Schwenke <martins@samba.org>
Fri, 17 Mar 2017 13:05:57 +0000 (14:05 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12697

During revoking readonly delegations, if one of the nodes disappears, then
there is no point re-trying revoking readonly delegation.  The database
needs to be recovered before the revoke operation can succeed.  So retry
only after a grace period.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Mar 17 14:05:57 CET 2017 on sn-devel-144

ctdb/server/ctdb_call.c

index a05ec1a9c7d40d436715d4a6f810c7df7b610563..8ce3928fd995adf46c85771c259c9b14dc2fe990 100644 (file)
@@ -1600,7 +1600,6 @@ static int deferred_call_destructor(struct revokechild_deferred_call *deferred_c
 {
        struct ctdb_context *ctdb = deferred_call->ctdb;
        struct revokechild_requeue_handle *requeue_handle = talloc(ctdb, struct revokechild_requeue_handle);
-       struct ctdb_req_call_old *c = (struct ctdb_req_call_old *)deferred_call->hdr;
 
        requeue_handle->ctdb = ctdb;
        requeue_handle->hdr  = deferred_call->hdr;
@@ -1608,9 +1607,12 @@ static int deferred_call_destructor(struct revokechild_deferred_call *deferred_c
        requeue_handle->ctx  = deferred_call->ctx;
        talloc_steal(requeue_handle, requeue_handle->hdr);
 
-       /* when revoking, any READONLY requests have 1 second grace to let read/write finish first */
+       /* Always delay revoke requests.  Either wait for the read/write
+        * operation to complete, or if revoking failed wait for recovery to
+        * complete
+        */
        tevent_add_timer(ctdb->ev, requeue_handle,
-                        timeval_current_ofs(c->flags & CTDB_WANT_READONLY ? 1 : 0, 0),
+                        timeval_current_ofs(1, 0),
                         deferred_call_requeue, requeue_handle);
 
        return 0;