]> git.sur5r.net Git - openldap/commitdiff
using write lock in accessing pslist
authorJong Hyuk Choi <jongchoi@openldap.org>
Wed, 23 Jun 2004 02:07:12 +0000 (02:07 +0000)
committerJong Hyuk Choi <jongchoi@openldap.org>
Wed, 23 Jun 2004 02:07:12 +0000 (02:07 +0000)
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c

index 476043febe5cdc61f20072f005d60cef05e7b810..faf1c54155ea3e5be2179b3aa31018659e03e978 100644 (file)
@@ -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 ) {
index cdd614bb4c8d578026aadbcb331b196a0ab00d0e..e81a3567a351dbef3fda5987c4d1e8926ae53e09 100644 (file)
@@ -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 );
index 9f81042e9b6f6712b3d8a416dd6f6e521d33c77e..dea52e79705aba862c350b41cef77746fc27766b 100644 (file)
@@ -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 );
index 749f6571deefbf33906fd52d3e7475a4218ae1e9..b8daf98caedf8fba2bff86236ca162c295e751d5 100644 (file)
@@ -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 ) {