ctdb-readonly: Avoid a tight loop waiting for revoke to complete
authorAmitay Isaacs <amitay@gmail.com>
Thu, 18 May 2017 01:50:09 +0000 (11:50 +1000)
committerKarolin Seeger <kseeger@samba.org>
Thu, 1 Jun 2017 06:49:15 +0000 (08:49 +0200)
commitc8b18ab76c6240cc6e992ab51dff379afbd4769f
treedcb2d9f1cf031e556c18f21223d9ae6680b0e75c
parent9dca467e98983e9f05d28005978646243ca7e5d8
ctdb-readonly: Avoid a tight loop waiting for revoke to complete

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 immedately.
The database needs to be recovered before the revoke operation can
succeed.

However, if the revoke is successful, then all the write requests need
to be processed immediately before the read-only requests.  This avoids
starving write requests, in case there are read-only requests coming
from other nodes.

In deferred_call_destructor, the result of revoke is not available and
deferred calls cannot be correctly ordered.  To correctly order the
deferred calls, process them in revokechild_destructor where the result
of revoke is known.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit f5f05a644dadc0b1858c99c5f1f5af1ef80f3a28)
ctdb/server/ctdb_call.c