From 399572ba50a393836ec2109feda3a9643a545487 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 9 May 2003 22:30:28 +0000 Subject: [PATCH] For ITS#2502 - force release of locks on exiting threads --- servers/slapd/back-bdb/cache.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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 -- 2.39.5