From: Jong Hyuk Choi Date: Thu, 6 Jun 2002 10:14:14 +0000 (+0000) Subject: remove dbenv->lock_put() call from transaction-protected operations X-Git-Tag: OPENLDAP_REL_ENG_2_MP~15 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=976fb2265f8b68b89c2e520d528843ce585d468c;p=openldap remove dbenv->lock_put() call from transaction-protected operations --- diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 303ed63a35..98fa9b8566 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -173,7 +173,7 @@ retry: /* transaction retry */ refs = is_entry_referral( matched ) ? get_entry_referrals( be, conn, op, matched ) : NULL; - bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, matched, &lock); + bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, matched ); matched = NULL; } else { @@ -204,7 +204,7 @@ retry: /* transaction retry */ case DB_LOCK_DEADLOCK: case DB_LOCK_NOTGRANTED: /* free parent and reader lock */ - bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, p, &lock ); + bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p ); p = NULL; goto retry; } @@ -266,7 +266,7 @@ retry: /* transaction retry */ matched_dn, NULL, refs, NULL ); ber_bvarray_free( refs ); - bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, p, &lock ); + bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p ); p = NULL; goto done; } @@ -279,7 +279,7 @@ retry: /* transaction retry */ #endif /* free parent and reader lock */ - bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, p, &lock ); + bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, p ); p = NULL; } else { diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 35d5a5720d..18854548fe 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -233,11 +233,11 @@ bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw ) #ifdef NEW_LOGGING LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1, - "bdb_cache_return_entry_rw: return (%ld):%s, refcnt=%d\n", + "bdb_unlocked_cache_return_entry_rw: return (%ld):%s, refcnt=%d\n", id, rw ? "w" : "r", refcnt )); #else Debug( LDAP_DEBUG_TRACE, - "====> bdb_cache_return_entry_%s( %ld ): created (%d)\n", + "====> bdb_unlocked_cache_return_entry_%s( %ld ): created (%d)\n", rw ? "w" : "r", id, refcnt ); #endif @@ -249,11 +249,11 @@ bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw ) #ifdef NEW_LOGGING LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1, - "bdb_cache_return_entry_rw: %ld, delete pending (%d).\n", + "bdb_unlocked_cache_return_entry_rw: %ld, delete pending (%d).\n", id, refcnt )); #else Debug( LDAP_DEBUG_TRACE, - "====> bdb_cache_return_entry_%s( %ld ): delete pending (%d)\n", + "====> bdb_unlocked_cache_return_entry_%s( %ld ): delete pending (%d)\n", rw ? "w" : "r", id, refcnt ); #endif @@ -268,11 +268,11 @@ bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw ) #ifdef NEW_LOGGING LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1, - "bdb_cache_return_entry_rw: (%ld): deleted (%d)\n", + "bdb_unlocked_cache_return_entry_rw: (%ld): deleted (%d)\n", id, refcnt )); #else Debug( LDAP_DEBUG_TRACE, - "====> bdb_cache_return_entry_%s( %ld ): deleted (%d)\n", + "====> bdb_unlocked_cache_return_entry_%s( %ld ): deleted (%d)\n", rw ? "w" : "r", id, refcnt ); #endif } @@ -283,11 +283,11 @@ bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw ) #ifdef NEW_LOGGING LDAP_LOG(( "cache", LDAP_LEVEL_DETAIL1, - "bdb_cache_return_entry_rw: ID %ld:%s returned (%d)\n", + "bdb_unlocked_cache_return_entry_rw: ID %ld:%s returned (%d)\n", id, rw ? "w": "r", refcnt )); #else Debug( LDAP_DEBUG_TRACE, - "====> bdb_cache_return_entry_%s( %ld ): returned (%d)\n", + "====> bdb_unlocked_cache_return_entry_%s( %ld ): returned (%d)\n", rw ? "w" : "r", id, refcnt); #endif } diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index 9ded16580e..a348631cc7 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -52,7 +52,7 @@ bdb_delete( if( 0 ) { retry: /* transaction retry */ if( e != NULL ) { - bdb_cache_return_entry_w(bdb->bi_dbenv, &bdb->bi_cache, e, &lock); + bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e); } #ifdef NEW_LOGGING LDAP_LOG (( "delete", LDAP_LEVEL_DETAIL1, @@ -152,7 +152,7 @@ retry: /* transaction retry */ rc = access_allowed( be, conn, op, p, children, NULL, ACL_WRITE, NULL ); - bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, p, &lock); + bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p); p = NULL; switch( opinfo.boi_err ) { @@ -268,7 +268,7 @@ retry: /* transaction retry */ refs = is_entry_referral( matched ) ? get_entry_referrals( be, conn, op, matched ) : NULL; - bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, matched, &lock ); + bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, matched); matched = NULL; } else { @@ -470,7 +470,7 @@ return_results: done: /* free entry */ if( e != NULL ) { - bdb_cache_return_entry_w(bdb->bi_dbenv, &bdb->bi_cache, e, &lock); + bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e); } if( ltid != NULL ) { diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 2e47ab49a5..d205b60060 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -262,7 +262,7 @@ bdb_modify( retry: /* transaction retry */ if( e != NULL ) { bdb_cache_delete_entry(&bdb->bi_cache, e); - bdb_cache_return_entry_w(bdb->bi_dbenv, &bdb->bi_cache, e, &lock); + bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e); } #ifdef NEW_LOGGING LDAP_LOG (( "modify", LDAP_LEVEL_DETAIL1, "bdb_modify: retrying...\n" )); @@ -342,7 +342,7 @@ retry: /* transaction retry */ refs = is_entry_referral( matched ) ? get_entry_referrals( be, conn, op, matched ) : NULL; - bdb_cache_return_entry_r (bdb->bi_dbenv, &bdb->bi_cache, matched, &lock); + bdb_unlocked_cache_return_entry_r (&bdb->bi_cache, matched); matched = NULL; } else { @@ -468,7 +468,7 @@ done: } if( e != NULL ) { - bdb_cache_return_entry_w (bdb->bi_dbenv, &bdb->bi_cache, e, &lock); + bdb_unlocked_cache_return_entry_w (&bdb->bi_cache, e); } return rc; } diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 0a7e1de7ee..30f345c7f0 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -81,13 +81,13 @@ bdb_modrdn( retry: /* transaction retry */ if (e != NULL) { bdb_cache_delete_entry(&bdb->bi_cache, e); - bdb_cache_return_entry_w(bdb->bi_dbenv, &bdb->bi_cache, e, &lock); + bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e); } if (p != NULL) { - bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, p, &lock); + bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p); } if (np != NULL) { - bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, np, &lock); + bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, np); } #ifdef NEW_LOGGING LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: retrying...\n")); @@ -157,7 +157,7 @@ retry: /* transaction retry */ refs = is_entry_referral( matched ) ? get_entry_referrals( be, conn, op, matched ) : NULL; - bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, matched, &lock ); + bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, matched); matched = NULL; } else { @@ -860,17 +860,17 @@ done: /* LDAP v3 Support */ if( np != NULL ) { /* free new parent and reader lock */ - bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, np, &lock); + bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, np); } if( p != NULL ) { /* free parent and reader lock */ - bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, p, &lock); + bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p); } /* free entry */ if( e != NULL ) { - bdb_cache_return_entry_w( bdb->bi_dbenv, &bdb->bi_cache, e, &lock ); + bdb_unlocked_cache_return_entry_w( &bdb->bi_cache, e); } if( ltid != NULL ) { diff --git a/servers/slapd/back-bdb/operational.c b/servers/slapd/back-bdb/operational.c index d0517abf9e..5278c23ba3 100644 --- a/servers/slapd/back-bdb/operational.c +++ b/servers/slapd/back-bdb/operational.c @@ -46,7 +46,7 @@ bdb_operational( retry: /* transaction retry */ #if 0 if( e != NULL ) { - bdb_cache_return_entry_w(bdb->bi_dbenv, &bdb->bi_cache, e, &lock); + bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e); } #endif #ifdef NEW_LOGGING diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index 7cfe90293f..f5c7af92fd 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -307,8 +307,8 @@ void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e, int rw, DB_ #define bdb_cache_return_entry_r(env, c, e, l) bdb_cache_return_entry_rw((env), (c), (e), 0, (l)) #define bdb_cache_return_entry_w(env, c, e, l) bdb_cache_return_entry_rw((env), (c), (e), 1, (l)) void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw ); -#define bdb_unlocked_cache_return_entry_r( c, e ) bdb_cache_return_entry_rw((c), (e), 0) -#define bdb_unlocked_cache_return_entry_w( c, e ) bdb_cache_return_entry_rw((c), (e), 1) +#define bdb_unlocked_cache_return_entry_r( c, e ) bdb_unlocked_cache_return_entry_rw((c), (e), 0) +#define bdb_unlocked_cache_return_entry_w( c, e ) bdb_unlocked_cache_return_entry_rw((c), (e), 1) int bdb_cache_add_entry_rw( DB_ENV *env, Cache *cache,