From bc6b28a6502537992757717271652b69b45d1061 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Wed, 23 Jun 2004 02:07:12 +0000 Subject: [PATCH] using write lock in accessing pslist --- servers/slapd/back-bdb/add.c | 4 ++-- servers/slapd/back-bdb/delete.c | 4 ++-- servers/slapd/back-bdb/modify.c | 8 ++++---- servers/slapd/back-bdb/modrdn.c | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 476043febe..faf1c54155 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -495,13 +495,13 @@ retry: /* transaction retry */ } if ( rs->sr_err == LDAP_SUCCESS && !op->o_no_psearch ) { - ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); assert( BEI(e) ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_ADD ); } - ldap_pvt_thread_rdwr_runlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } if(( rs->sr_err=TXN_COMMIT( ltid, 0 )) != 0 ) { diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index cdd614bb4c..e81a3567a3 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -561,11 +561,11 @@ retry: /* transaction retry */ } if ( rs->sr_err == LDAP_SUCCESS && !op->o_no_psearch ) { - ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) { bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE ); } - ldap_pvt_thread_rdwr_runlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } rs->sr_err = TXN_COMMIT( ltid, 0 ); diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 9f81042e9b..dea52e7970 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -530,11 +530,11 @@ retry: /* transaction retry */ } if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop && !op->o_no_psearch ) { - ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { bdb_psearch(op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY ); } - ldap_pvt_thread_rdwr_runlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } if( op->o_preread ) { @@ -676,11 +676,10 @@ retry: /* transaction retry */ if ( rs->sr_err == LDAP_SUCCESS ) { /* Loop through in-scope entries for each psearch spec */ - ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_MODIFY ); } - ldap_pvt_thread_rdwr_runlock( &bdb->bi_pslist_rwlock ); pm_list = LDAP_LIST_FIRST(&op->o_pm_list); while ( pm_list != NULL ) { bdb_psearch(op, rs, pm_list->ps_op, @@ -690,6 +689,7 @@ retry: /* transaction retry */ pm_list = LDAP_LIST_NEXT ( pm_list, ps_link ); ch_free( pm_prev ); } + ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } rs->sr_err = TXN_COMMIT( ltid, 0 ); diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 749f6571de..b8daf98cae 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -888,11 +888,11 @@ retry: /* transaction retry */ } if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop && !op->o_no_psearch ) { - ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY ); } - ldap_pvt_thread_rdwr_runlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } /* modify entry */ @@ -1034,11 +1034,10 @@ retry: /* transaction retry */ if ( rs->sr_err == LDAP_SUCCESS ) { /* Loop through in-scope entries for each psearch spec */ - ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock ); + ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) { bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_MODIFY ); } - ldap_pvt_thread_rdwr_runlock( &bdb->bi_pslist_rwlock ); pm_list = LDAP_LIST_FIRST(&op->o_pm_list); while ( pm_list != NULL ) { bdb_psearch(op, rs, pm_list->ps_op, @@ -1048,6 +1047,7 @@ retry: /* transaction retry */ pm_list = LDAP_LIST_NEXT ( pm_list, ps_link ); ch_free( pm_prev ); } + ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); } if(( rs->sr_err=TXN_COMMIT( ltid, 0 )) != 0 ) { -- 2.39.5