ctdb-locking: Do not merge multiple lock requests to avoid unfair scheduling
authorAmitay Isaacs <amitay@gmail.com>
Mon, 18 Nov 2013 04:48:22 +0000 (15:48 +1100)
committerMichael Adam <obnox@samba.org>
Wed, 27 Nov 2013 17:46:16 +0000 (18:46 +0100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
ctdb/server/ctdb_lock.c

index 23be5f52e4cbb93b0197058f4f446b6210bda689..1c333966060c3f00515a7007bf2fabe6d287d9a4 100644 (file)
@@ -893,7 +893,7 @@ static struct lock_request *ctdb_lock_internal(struct ctdb_context *ctdb,
                                               enum lock_type type,
                                               bool auto_mark)
 {
-       struct lock_context *lock_ctx;
+       struct lock_context *lock_ctx = NULL;
        struct lock_request *request;
 
        if (callback == NULL) {
@@ -901,9 +901,14 @@ static struct lock_request *ctdb_lock_internal(struct ctdb_context *ctdb,
                return NULL;
        }
 
+#if 0
+       /* Disable this optimization to ensure first-in-first-out fair
+        * scheduling of lock requests */
+
        /* get a context for this key - search only the pending contexts,
         * current contexts might in the middle of processing callbacks */
        lock_ctx = find_lock_context(ctdb->lock_pending, ctdb_db, key, priority, type);
+#endif
 
        /* No existing context, create one */
        if (lock_ctx == NULL) {