diff options
author | Amitay Isaacs <amitay@gmail.com> | 2014-07-15 14:13:25 +1000 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2014-08-04 17:59:52 +0200 |
commit | 7189437be447d33038eb26bca055b1025cebacd3 (patch) | |
tree | c3a655f2aa9b6cc0a888e1c4e11c646c689a16bf | |
parent | 3aa96c3a3eb87fc6a1ad94c983e363b402b48ff5 (diff) | |
download | samba-7189437be447d33038eb26bca055b1025cebacd3.tar.gz samba-7189437be447d33038eb26bca055b1025cebacd3.tar.xz samba-7189437be447d33038eb26bca055b1025cebacd3.zip |
ctdb-locking: Add DB lock requests to head of the pending queue
This allows to schedule DB locks quickly without having to scan through
the pending lock requests.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
-rw-r--r-- | ctdb/server/ctdb_lock.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c index b9740857c1..1100c7c17a 100644 --- a/ctdb/server/ctdb_lock.c +++ b/ctdb/server/ctdb_lock.c @@ -858,7 +858,14 @@ static struct lock_request *ctdb_lock_internal(struct ctdb_context *ctdb, lock_ctx->request = request; lock_ctx->child = -1; - DLIST_ADD_END(ctdb->lock_pending, lock_ctx, NULL); + /* Non-record locks are required by recovery and should be scheduled + * immediately, so keep them at the head of the pending queue. + */ + if (lock_ctx->type == LOCK_RECORD) { + DLIST_ADD_END(ctdb->lock_pending, lock_ctx, NULL); + } else { + DLIST_ADD(ctdb->lock_pending, lock_ctx); + } CTDB_INCREMENT_STAT(ctdb, locks.num_pending); if (ctdb_db) { CTDB_INCREMENT_DB_STAT(ctdb_db, locks.num_pending); |