]> git.sur5r.net Git - openldap/commitdiff
ITS#4572 don't unlock non-existent locks
authorHoward Chu <hyc@openldap.org>
Thu, 1 Jun 2006 02:03:10 +0000 (02:03 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 1 Jun 2006 02:03:10 +0000 (02:03 +0000)
servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/dn2entry.c

index 4bff759a9e14febe0c78280a9b83661b7343feb9..6273eb0704ab91f889b9891c4e0f4b26e9fa279e 100644 (file)
@@ -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;
index 1814cc22c77d55276b6504dbb157a06bf199ff16..1ba92956ce986a5d664dd4fe319ffb10dfb0f078 100644 (file)
@@ -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 );
                }