From 7c6afdf7d1805a598d3dc7beaf0e4cacea998601 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 29 Jan 2002 19:43:17 +0000 Subject: [PATCH] Fix giant lock handling on entry release --- servers/slapd/back-ldbm/add.c | 10 ++++++---- servers/slapd/back-ldbm/entry.c | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 9baac81065..5cf93afd82 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -375,12 +375,14 @@ return_results:; } if ( rc ) { - /* in case of error, writer lock is freed - * and entry's private data is destroyed */ + /* + * in case of error, writer lock is freed + * and entry's private data is destroyed. + * otherwise, this is done when entry is released + */ cache_return_entry_w( &li->li_cache, e ); + ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock); } - ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock); - return( rc ); } diff --git a/servers/slapd/back-ldbm/entry.c b/servers/slapd/back-ldbm/entry.c index f018d2b129..9e2cdc17f5 100644 --- a/servers/slapd/back-ldbm/entry.c +++ b/servers/slapd/back-ldbm/entry.c @@ -31,6 +31,11 @@ ldbm_back_entry_release_rw( if ( slapMode == SLAP_SERVER_MODE ) { /* free entry and reader or writer lock */ cache_return_entry_rw( &li->li_cache, e, rw ); + if( rw ) { + ldap_pvt_thread_rdwr_wunlock( &li->li_giant_rwlock ); + } else { + ldap_pvt_thread_rdwr_runlock( &li->li_giant_rwlock ); + } } else { entry_free( e ); -- 2.39.5