From: Howard Chu Date: Wed, 7 Feb 2007 02:49:40 +0000 (+0000) Subject: Improve prev commit X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~53 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9d86bf253f1fc92034d1a2dfc038cdacf90a2a50;p=openldap Improve prev commit --- diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 6ac3bceac1..ed68e77dc7 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1548,6 +1548,7 @@ syncprov_op_response( Operation *op, SlapReply *rs ) { struct berval maxcsn = BER_BVNULL; char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; + int do_check = 0; /* Update our context CSN */ cbuf[0] = '\0'; @@ -1584,7 +1585,6 @@ syncprov_op_response( Operation *op, SlapReply *rs ) si->si_numops++; if ( si->si_chkops || si->si_chktime ) { - int do_check = 0; if ( si->si_chkops && si->si_numops >= si->si_chkops ) { do_check = 1; si->si_numops = 0; @@ -1594,12 +1594,15 @@ syncprov_op_response( Operation *op, SlapReply *rs ) do_check = 1; si->si_chklast = op->o_time; } - if ( do_check ) { - syncprov_checkpoint( op, rs, on ); - } } ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock ); + if ( do_check ) { + ldap_pvt_thread_rdwr_rlock( &si->si_csn_rwlock ); + syncprov_checkpoint( op, rs, on ); + ldap_pvt_thread_rdwr_runlock( &si->si_csn_rwlock ); + } + opc->sctxcsn.bv_len = maxcsn.bv_len; opc->sctxcsn.bv_val = cbuf;