From 8f7da062f55c7392f9f793d2455a3843c884a9ac Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 18 Oct 2005 20:52:04 +0000 Subject: [PATCH] ITS#4088 force cursors to use same locker --- servers/slapd/back-bdb/cache.c | 5 +++-- servers/slapd/back-bdb/dn2id.c | 4 ++++ servers/slapd/back-bdb/proto-bdb.h | 2 ++ servers/slapd/back-bdb/tools.c | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 598549e8cd..eb894b2757 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -388,6 +388,7 @@ int hdb_cache_find_parent( Operation *op, DB_TXN *txn, + u_int32_t locker, ID id, EntryInfo **res ) { @@ -401,7 +402,7 @@ hdb_cache_find_parent( ei.bei_ckids = 0; for (;;) { - rc = hdb_dn2id_parent( op, txn, &ei, &eip.bei_id ); + rc = hdb_dn2id_parent( op, txn, locker, &ei, &eip.bei_id ); if ( rc ) break; /* Save the previous node, if any */ @@ -718,7 +719,7 @@ again: ldap_pvt_thread_rdwr_rlock( &bdb->bi_cache.c_rwlock ); } } #else - rc = hdb_cache_find_parent(op, tid, id, eip ); + rc = hdb_cache_find_parent(op, tid, locker, id, eip ); if ( rc == 0 && *eip ) islocked = 1; #endif } diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index d2ed137e97..f23ec7f915 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -709,6 +709,7 @@ int hdb_dn2id_parent( Operation *op, DB_TXN *txn, + u_int32_t locker, EntryInfo *ei, ID *idp ) { @@ -733,6 +734,9 @@ hdb_dn2id_parent( rc = db->cursor( db, txn, &cursor, bdb->bi_db_opflags ); if ( rc ) return rc; + if ( !txn && locker ) { + cursor->locker = locker; + } data.ulen = sizeof(diskNode) + (SLAP_LDAPDN_MAXLEN * 2); d = op->o_tmpalloc( data.ulen, op->o_tmpmemctx ); diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index 232289f7c9..a71728f6c0 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -124,6 +124,7 @@ int bdb_dn2idl( int bdb_dn2id_parent( Operation *op, DB_TXN *txn, + u_int32_t locker, EntryInfo *ei, ID *idp ); @@ -500,6 +501,7 @@ int bdb_cache_find_parent( Operation *op, DB_TXN *txn, + u_int32_t locker, ID id, EntryInfo **res ); diff --git a/servers/slapd/back-bdb/tools.c b/servers/slapd/back-bdb/tools.c index 6064d93842..c4920f4f3b 100644 --- a/servers/slapd/back-bdb/tools.c +++ b/servers/slapd/back-bdb/tools.c @@ -214,7 +214,7 @@ Entry* bdb_tool_entry_get( BackendDB *be, ID id ) op.o_tmpmemctx = NULL; op.o_tmpmfuncs = &ch_mfuncs; - rc = bdb_cache_find_parent( &op, NULL, id, &ei ); + rc = bdb_cache_find_parent( &op, NULL, cursor->locker, id, &ei ); if ( rc == LDAP_SUCCESS ) { bdb_cache_entryinfo_unlock( ei ); e->e_private = ei; -- 2.39.5