]> git.sur5r.net Git - openldap/commitdiff
Fix giant lock handling on entry release
authorKurt Zeilenga <kurt@openldap.org>
Tue, 29 Jan 2002 19:43:17 +0000 (19:43 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 29 Jan 2002 19:43:17 +0000 (19:43 +0000)
servers/slapd/back-ldbm/add.c
servers/slapd/back-ldbm/entry.c

index 9baac8106575f52ee31ab38f91161e8bc8120eed..5cf93afd82d4fd6880ceb9da8dcc90cd1064fd63 100644 (file)
@@ -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 );
 }
index f018d2b1299914b19202c46b3b838f02f503be48..9e2cdc17f5e0b5d617d858276516862c332d3121 100644 (file)
@@ -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 );