dbwrap: introduce DBWRAP_LOCK_ORDER_NONE for lock order "0".
authorMichael Adam <obnox@samba.org>
Mon, 27 Jan 2014 16:20:56 +0000 (17:20 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 7 Feb 2014 15:06:07 +0000 (16:06 +0100)
Ther are still some databases which are opened (locally) with
lock oder 0, which means don't do lock oder checking,
thereby circumventing this deadlock-prevention mechanism.

Add a symbolic constant for this "0" to make this circumvention
more explicit.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/dbwrap/dbwrap.c
lib/dbwrap/dbwrap.h

index 8270b63a1a23e5d93e212080c0a043358b450eba..3606617e2e82f16011960aee5f93ff7cb48d6e9f 100644 (file)
@@ -212,7 +212,7 @@ static struct db_record *dbwrap_fetch_locked_internal(
        struct db_record *rec;
        struct dbwrap_lock_order_state *lock_order = NULL;
 
-       if (db->lock_order != 0) {
+       if (db->lock_order != DBWRAP_LOCK_ORDER_NONE) {
                lock_order = dbwrap_check_lock_order(db, mem_ctx);
                if (lock_order == NULL) {
                        return NULL;
index 1949d5f8e5e256892a7c973ebeee9c73276ea0dc..03cc3f4a7b9004cf9a66dd216869af6df239b04c 100644 (file)
@@ -26,6 +26,7 @@ struct db_record;
 struct db_context;
 
 enum dbwrap_lock_order {
+       DBWRAP_LOCK_ORDER_NONE = 0, /* Don't check lock orders for this db. */
        DBWRAP_LOCK_ORDER_1 = 1,
        DBWRAP_LOCK_ORDER_2 = 2,
        DBWRAP_LOCK_ORDER_3 = 3