From 70512edd5ac895dc18278f8bac864dd6d110ea21 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 1 Jun 2006 02:03:10 +0000 Subject: [PATCH] ITS#4572 don't unlock non-existent locks --- servers/slapd/back-bdb/cache.c | 2 +- servers/slapd/back-bdb/dn2entry.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 4bff759a9e..6273eb0704 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -146,7 +146,7 @@ bdb_cache_entry_db_unlock ( DB_ENV *env, DB_LOCK *lock ) #else int rc; - if ( !lock ) return 0; + if ( !lock || lock->mode == DB_LOCK_NG ) return 0; rc = LOCK_PUT ( env, lock ); return rc; diff --git a/servers/slapd/back-bdb/dn2entry.c b/servers/slapd/back-bdb/dn2entry.c index 1814cc22c7..1ba92956ce 100644 --- a/servers/slapd/back-bdb/dn2entry.c +++ b/servers/slapd/back-bdb/dn2entry.c @@ -56,8 +56,11 @@ bdb_dn2entry( rc2 = bdb_cache_find_id( op, tid, ei->bei_id, &ei, 1, locker, lock ); if ( rc2 ) rc = rc2; - } else if ( ei ) + } else if ( ei ) { bdb_cache_entryinfo_unlock( ei ); + memset( lock, 0, sizeof( *lock )); + lock->mode = DB_LOCK_NG; + } } else if ( ei ) { bdb_cache_entryinfo_unlock( ei ); } -- 2.39.5