From: Howard Chu Date: Thu, 26 Oct 2006 15:34:40 +0000 (+0000) Subject: ITS#4720 release csn mutex before checkpointing. X-Git-Tag: OPENLDAP_REL_ENG_2_3_MP~35 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b009b1820edc142fcda20f3f58c689220937c3d6;p=openldap ITS#4720 release csn mutex before checkpointing. --- diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index c17597392f..85aa485c3d 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1260,9 +1260,9 @@ syncprov_op_cleanup( Operation *op, SlapReply *rs ) } static void -syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on ) +syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on, + struct berval *csn ) { - syncprov_info_t *si = on->on_bi.bi_private; Modifications mod; Operation opm; SlapReply rsm = { 0 }; @@ -1270,12 +1270,12 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on ) slap_callback cb = {0}; /* If ctxcsn is empty, delete it */ - if ( BER_BVISEMPTY( &si->si_ctxcsn )) { + if ( BER_BVISEMPTY( csn )) { mod.sml_values = NULL; } else { mod.sml_values = bv; bv[1].bv_val = NULL; - bv[0] = si->si_ctxcsn; + bv[0] = *csn; } mod.sml_nvalues = NULL; mod.sml_desc = slap_schema.si_ad_contextCSN; @@ -1510,6 +1510,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'; @@ -1532,7 +1533,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; @@ -1542,15 +1542,16 @@ 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_mutex_unlock( &si->si_csn_mutex ); opc->sctxcsn.bv_len = maxcsn.bv_len; opc->sctxcsn.bv_val = cbuf; + if ( do_check ) { + syncprov_checkpoint( op, rs, on, &opc->sctxcsn ); + } + /* Handle any persistent searches */ if ( si->si_ops ) { switch(op->o_tag) { @@ -2472,7 +2473,7 @@ syncprov_db_close( op->o_bd = be; op->o_dn = be->be_rootdn; op->o_ndn = be->be_rootndn; - syncprov_checkpoint( op, &rs, on ); + syncprov_checkpoint( op, &rs, on, &si->si_ctxcsn ); ldap_pvt_thread_pool_context_reset( thrctx ); }