From 21dc1075c37b505ed82275b572c01387509f4148 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Thu, 27 Mar 2014 15:06:58 +1100 Subject: [PATCH] client: ctdb_fetch_lock should check for readonly delegations When readonly delegations were added, ctdb_fetch_lock code should have been modified to include the check for readonly flags. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (Imported from commit 78015320b60b0fd0d8c3dc65fbbe3e38e4a02993) --- client/ctdb_client.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/ctdb_client.c b/client/ctdb_client.c index 885dbfdf..75601152 100644 --- a/client/ctdb_client.c +++ b/client/ctdb_client.c @@ -709,6 +709,21 @@ again: goto again; } + /* if this is a request for read/write and we have delegations + we have to revoke all delegations first + */ + if ((h->header.dmaster == ctdb_db->ctdb->pnn) && + (h->header.flags & CTDB_REC_RO_HAVE_DELEGATIONS)) { + ctdb_ltdb_unlock(ctdb_db, key); + ret = ctdb_client_force_migration(ctdb_db, key); + if (ret != 0) { + DEBUG(DEBUG_DEBUG,("ctdb_fetch_readonly_lock: force_migration failed\n")); + talloc_free(h); + return NULL; + } + goto again; + } + DEBUG(DEBUG_DEBUG,("ctdb_fetch_lock: we are dmaster - done\n")); return h; } -- 2.34.1