From 77ba70be13d5aeea912caf55d343a70acf0f5f59 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 18 Aug 2004 10:53:34 +0000 Subject: [PATCH] Fix ITS#3288: use be_pcl_mutexp instead of be_pcl_mutex --- servers/slapd/backend.c | 3 ++- servers/slapd/ctxcsn.c | 16 ++++++++-------- servers/slapd/slap.h | 1 + 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index a5933e7cb1..dfdfc4c50f 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -644,7 +644,8 @@ backend_db_init( be->be_context_csn.bv_len = 0; be->be_context_csn.bv_val = NULL; - ldap_pvt_thread_mutex_init( &be->be_pcl_mutex ); + be->be_pcl_mutexp = &be->be_pcl_mutex; + ldap_pvt_thread_mutex_init( be->be_pcl_mutexp ); ldap_pvt_thread_mutex_init( &be->be_context_csn_mutex ); LDAP_STAILQ_INIT( &be->be_syncinfo ); diff --git a/servers/slapd/ctxcsn.c b/servers/slapd/ctxcsn.c index c978ae90cf..b67fc7dff9 100644 --- a/servers/slapd/ctxcsn.c +++ b/servers/slapd/ctxcsn.c @@ -39,7 +39,7 @@ slap_get_commit_csn( Operation *op, struct berval *csn ) csn->bv_val = NULL; csn->bv_len = 0; - ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex ); + ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) { if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) { @@ -54,7 +54,7 @@ slap_get_commit_csn( Operation *op, struct berval *csn ) } if ( committed_csne ) ber_dupbv_x( csn, committed_csne->ce_csn, op->o_tmpmemctx ); - ldap_pvt_thread_mutex_unlock( &op->o_bd->be_pcl_mutex ); + ldap_pvt_thread_mutex_unlock( op->o_bd->be_pcl_mutexp ); } void @@ -62,7 +62,7 @@ slap_rewind_commit_csn( Operation *op ) { struct slap_csn_entry *csne; - ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex ); + ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) { if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) { @@ -71,7 +71,7 @@ slap_rewind_commit_csn( Operation *op ) } } - ldap_pvt_thread_mutex_unlock( &op->o_bd->be_pcl_mutex ); + ldap_pvt_thread_mutex_unlock( op->o_bd->be_pcl_mutexp ); } void @@ -82,7 +82,7 @@ slap_graduate_commit_csn( Operation *op ) if ( op == NULL ) return; if ( op->o_bd == NULL ) return; - ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex ); + ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) { if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) { @@ -95,7 +95,7 @@ slap_graduate_commit_csn( Operation *op ) } } - ldap_pvt_thread_mutex_unlock( &op->o_bd->be_pcl_mutex ); + ldap_pvt_thread_mutex_unlock( op->o_bd->be_pcl_mutexp ); return; } @@ -160,7 +160,7 @@ slap_get_csn( if ( manage_ctxcsn ) { pending = (struct slap_csn_entry *) ch_calloc( 1, sizeof( struct slap_csn_entry )); - ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex ); + ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); ber_dupbv( &op->o_sync_csn, csn ); pending->ce_csn = ber_dupbv( NULL, csn ); pending->ce_connid = op->o_connid; @@ -168,7 +168,7 @@ slap_get_csn( pending->ce_state = SLAP_CSN_PENDING; LDAP_TAILQ_INSERT_TAIL( op->o_bd->be_pending_csn_list, pending, ce_csn_link ); - ldap_pvt_thread_mutex_unlock( &op->o_bd->be_pcl_mutex ); + ldap_pvt_thread_mutex_unlock( op->o_bd->be_pcl_mutexp ); } return LDAP_SUCCESS; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index e7d66dd85d..690dab061a 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1581,6 +1581,7 @@ struct slap_backend_db { BerVarray be_update_refs; /* where to refer modifying clients to */ struct be_pcl *be_pending_csn_list; ldap_pvt_thread_mutex_t be_pcl_mutex; + ldap_pvt_thread_mutex_t *be_pcl_mutexp; struct berval be_context_csn; ldap_pvt_thread_mutex_t be_context_csn_mutex; LDAP_STAILQ_HEAD( be_si, syncinfo_s ) be_syncinfo; /* For syncrepl */ -- 2.39.5