#ifdef BDB_SUBENTRIES
int subentry;
#endif
- u_int32_t locker;
+ u_int32_t locker = 0;
DB_LOCK lock;
#if 0
u_int32_t lockid;
opinfo.boi_bdb = be;
opinfo.boi_txn = ltid;
+ opinfo.boi_locker = locker;
opinfo.boi_err = 0;
op->o_private = &opinfo;
const char *entry_at_name = entry_at->ad_cname.bv_val;
AccessControlState acl_state = ACL_STATE_INIT;
- u_int32_t locker;
+ u_int32_t locker = 0;
DB_LOCK lock;
+ int free_lock_id = 0;
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, ARGS,
if( op ) boi = (struct bdb_op_info *) op->o_private;
if( boi != NULL && be == boi->boi_bdb ) {
txn = boi->boi_txn;
+ locker = boi->boi_locker;
}
if ( txn != NULL ) {
locker = TXN_ID ( txn );
- } else {
+ } else if ( !locker ) {
rc = LOCK_ID ( bdb->bi_dbenv, &locker );
+ free_lock_id = 1;
switch(rc) {
case 0:
break;
case DB_LOCK_NOTGRANTED:
goto dn2entry_retry;
default:
- if( txn != NULL ) {
- boi->boi_err = rc;
- }
- else {
+ boi->boi_err = rc;
+ if ( free_lock_id ) {
LOCK_ID_FREE( bdb->bi_dbenv, locker );
}
return (rc != LDAP_BUSY) ? LDAP_OTHER : LDAP_BUSY;
"=> bdb_attribute: cannot find entry: \"%s\"\n",
entry_ndn->bv_val, 0, 0 );
#endif
- if ( txn == NULL ) {
+ if ( free_lock_id ) {
LOCK_ID_FREE( bdb->bi_dbenv, locker );
}
return LDAP_NO_SUCH_OBJECT;
bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, e, &lock);
}
- if ( txn == NULL ) {
+ if ( free_lock_id ) {
LOCK_ID_FREE( bdb->bi_dbenv, locker );
}
struct bdb_op_info {
BackendDB* boi_bdb;
DB_TXN* boi_txn;
- int boi_err;
+ u_int32_t boi_err;
+ u_int32_t boi_locker;
};
#define DB_OPEN(db, file, name, type, flags, mode) \
DB_TXN *ltid = NULL;
struct bdb_op_info opinfo;
- u_int32_t locker;
+ u_int32_t locker = 0;
DB_LOCK lock;
#if 0
u_int32_t lockid;
opinfo.boi_bdb = be;
opinfo.boi_txn = ltid;
+ opinfo.boi_locker = locker;
opinfo.boi_err = 0;
op->o_private = &opinfo;
const char *group_oc_name = NULL;
const char *group_at_name = group_at->ad_cname.bv_val;
- u_int32_t locker;
+ u_int32_t locker = 0;
DB_LOCK lock;
+ int free_lock_id = 0;
if( group_oc->soc_names && group_oc->soc_names[0] ) {
group_oc_name = group_oc->soc_names[0];
group_oc_name = group_oc->soc_oid;
}
+ printf("KKK\n");
+
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, ENTRY,
"bdb_group: check (%s) member of (%s), oc %s\n",
if( op ) boi = (struct bdb_op_info *) op->o_private;
if( boi != NULL && be == boi->boi_bdb ) {
txn = boi->boi_txn;
+ locker = boi->boi_locker;
}
if ( txn ) {
locker = TXN_ID( txn );
- } else {
+ } else if ( !locker ) {
rc = LOCK_ID ( bdb->bi_dbenv, &locker );
+ free_lock_id = 1;
switch(rc) {
case 0:
break;
if( rc ) {
if ( rc == DB_LOCK_DEADLOCK || rc == DB_LOCK_NOTGRANTED )
goto dn2entry_retry;
- if( txn ) {
- boi->boi_err = rc;
- }
- else {
+ boi->boi_err = rc;
+ if ( free_lock_id ) {
LOCK_ID_FREE ( bdb->bi_dbenv, locker );
}
return( 1 );
"=> bdb_group: cannot find group: \"%s\"\n",
gr_ndn->bv_val, 0, 0 );
#endif
- if ( txn == NULL ) {
+ if ( free_lock_id ) {
LOCK_ID_FREE ( bdb->bi_dbenv, locker );
}
return( 1 );
bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, e, &lock );
}
- if ( txn == NULL ) {
+ if ( free_lock_id ) {
LOCK_ID_FREE ( bdb->bi_dbenv, locker );
}
DB_TXN *ltid = NULL;
struct bdb_op_info opinfo;
- u_int32_t locker;
+ u_int32_t locker = 0;
DB_LOCK lock;
int noop = 0;
opinfo.boi_bdb = be;
opinfo.boi_txn = ltid;
+ opinfo.boi_locker = locker;
opinfo.boi_err = 0;
op->o_private = &opinfo;
int manageDSAit = get_manageDSAit( op );
- u_int32_t locker;
+ u_int32_t locker = 0;
DB_LOCK lock;
int noop = 0;
opinfo.boi_bdb = be;
opinfo.boi_txn = ltid;
+ opinfo.boi_locker = locker;
opinfo.boi_err = 0;
op->o_private = &opinfo;
opinfo.boi_bdb = be;
opinfo.boi_txn = ltid;
+ opinfo.boi_locker = TXN_ID ( ltid );
opinfo.boi_err = 0;
op->o_private = &opinfo;
struct berval dn;
struct berval ndn;
- u_int32_t locker;
+ u_int32_t locker = 0;
DB_LOCK lock;
assert( reqoid != NULL );
opinfo.boi_bdb = be;
opinfo.boi_txn = ltid;
+ opinfo.boi_locker = locker;
opinfo.boi_err = 0;
op->o_private = &opinfo;
struct slap_limits_set *limit = NULL;
int isroot = 0;
- u_int32_t locker;
+ u_int32_t locker = 0;
DB_LOCK lock;
+ struct bdb_op_info opinfo;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "bdb_back_search\n", 0, 0, 0 );
pagedresults = get_pagedresults( op );
rc = LOCK_ID (bdb->bi_dbenv, &locker );
+
+ printf("locker = %d\n", locker);
+
switch(rc) {
case 0:
break;
return rc;
}
+ opinfo.boi_bdb = be;
+ opinfo.boi_txn = NULL;
+ opinfo.boi_locker = locker;
+ opinfo.boi_err = 0;
+ op->o_private = &opinfo;
+
if ( nbase->bv_len == 0 ) {
/* DIT root special case */
e = (Entry *) &slap_entry_root;