From: Howard Chu Date: Fri, 9 May 2003 22:30:28 +0000 (+0000) Subject: For ITS#2502 - force release of locks on exiting threads X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~152 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=399572ba50a393836ec2109feda3a9643a545487;p=openldap For ITS#2502 - force release of locks on exiting threads --- diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index f9d28852b7..832e4931c4 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -926,8 +926,28 @@ bdb_locker_id_free( void *key, void *data ) { DB_ENV *env = key; int lockid = (int) data; + int rc; + - XLOCK_ID_FREE( env, lockid ); + rc = XLOCK_ID_FREE( env, lockid ); + if ( rc == EINVAL ) { + DB_LOCKREQ lr; +#ifdef NEW_LOGGING + LDAP_LOG( BACK_BDB, ERR, + "bdb_locker_id_free: %d err %s(%d)\n", + lockid, db_strerror(rc), rc ); +#else + Debug( LDAP_DEBUG_ANY, + "bdb_locker_id_free: %d err %s(%d)\n", + lockid, db_strerror(rc), rc ); +#endif + memset( &lr, 0, sizeof(lr) ); + + /* release all locks held by this locker. */ + lr.op = DB_LOCK_PUT_ALL; + env->lock_vec( env, lockid, 0, &lr, 1, NULL ); + XLOCK_ID_FREE( env, lockid ); + } } int