From: Howard Chu Date: Thu, 1 Jun 2006 02:03:10 +0000 (+0000) Subject: ITS#4572 don't unlock non-existent locks X-Git-Tag: OPENLDAP_REL_ENG_2_4_3ALPHA~9^2~187 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=70512edd5ac895dc18278f8bac864dd6d110ea21;p=openldap ITS#4572 don't unlock non-existent locks --- 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 ); }