From 14d4ca86e16e489124057fed6a3b7ef58345e8cb Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 14 Mar 2009 09:03:30 +0000 Subject: [PATCH] Fix prev 2 commits: make sure op is Modify before testing modlist, don't checkpoint when adding the context entry to a DB --- servers/slapd/overlays/syncprov.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 01015172e7..f1af8c9e58 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1644,7 +1644,7 @@ syncprov_op_response( Operation *op, SlapReply *rs ) maxcsn.bv_len = sizeof(cbuf); ldap_pvt_thread_rdwr_wlock( &si->si_csn_rwlock ); - if ( op->o_dont_replicate && + if ( op->o_dont_replicate && op->o_tag == LDAP_REQ_MODIFY && op->orm_modlist->sml_op == LDAP_MOD_REPLACE && op->orm_modlist->sml_desc == slap_schema.si_ad_contextCSN ) { /* Catch contextCSN updates from syncrepl. We have to look at @@ -1749,17 +1749,23 @@ syncprov_op_response( Operation *op, SlapReply *rs ) si->si_numops++; if ( si->si_chkops || si->si_chktime ) { - if ( si->si_chkops && si->si_numops >= si->si_chkops ) { - do_check = 1; - si->si_numops = 0; - } - if ( si->si_chktime && - (op->o_time - si->si_chklast >= si->si_chktime )) { - if ( si->si_chklast ) { + /* Never checkpoint adding the context entry, + * it will deadlock + */ + if ( op->o_tag != LDAP_REQ_ADD || + !dn_match( &op->o_req_ndn, &op->o_bd->be_nsuffix[0] )) { + if ( si->si_chkops && si->si_numops >= si->si_chkops ) { do_check = 1; - si->si_chklast = op->o_time; - } else { - si->si_chklast = 1; + si->si_numops = 0; + } + if ( si->si_chktime && + (op->o_time - si->si_chklast >= si->si_chktime )) { + if ( si->si_chklast ) { + do_check = 1; + si->si_chklast = op->o_time; + } else { + si->si_chklast = 1; + } } } } -- 2.39.5