From 930517c4f40c483eb3733bbaa6252ef68502db6e Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Tue, 3 Nov 2015 15:59:54 +0100 Subject: [PATCH 1/2] Ticket 47976: deadlock in mep delete post op Bug Description: The deadlock occurs because MEP plugin will delete an mep entry that is localized in the same page as the original entry. The page of the original entry is acquired in write and the MEP plugin can only read it if it is reading it with the parent txn. This bug requires that the MEP entry is not in the entry cache when the parent entry is deleted Fix Description: Make sure MEP plugin pass the parent txn to the internal delete. Also fix ldbm_delete, that read the id2entry db without txn https://fedorahosted.org/389/ticket/47976 Reviewed by: ? Platforms tested: F17 Flag Day: no Doc impact: no --- ldap/servers/plugins/mep/mep.c | 3 +++ ldap/servers/slapd/back-ldbm/ldbm_delete.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c index 46acb4b..ba10410 100644 --- a/ldap/servers/plugins/mep/mep.c +++ b/ldap/servers/plugins/mep/mep.c @@ -2502,9 +2502,11 @@ mep_del_post_op(Slapi_PBlock *pb) Slapi_Entry *e = NULL; Slapi_DN *sdn = NULL; int result = SLAPI_PLUGIN_SUCCESS; + void *parent_txn; slapi_log_error(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM, "--> mep_del_post_op\n"); + slapi_pblock_get( pb, SLAPI_TXN, (void**)&parent_txn ); /* Reload config if a config entry was deleted. */ if ((sdn = mep_get_sdn(pb))) { @@ -2544,6 +2546,7 @@ mep_del_post_op(Slapi_PBlock *pb) "\"%s\".\n ", managed_dn, slapi_sdn_get_dn(sdn)); slapi_delete_internal_set_pb(mep_pb, managed_dn, NULL, NULL, mep_get_plugin_id(), 0); + slapi_pblock_set(mep_pb, SLAPI_TXN, parent_txn); slapi_delete_internal_pb(mep_pb); slapi_pblock_get(mep_pb, SLAPI_PLUGIN_INTOP_RESULT, &result); if(result){ diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c index f31d545..100a71d 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c @@ -477,7 +477,7 @@ ldbm_back_delete( Slapi_PBlock *pb ) * the parent. If we fail to lock the entry, just try again. */ while(1){ - parent = id2entry(be, pid ,NULL, &retval); + parent = id2entry(be, pid ,&txn, &retval); if (parent && (cache_retry = cache_lock_entry(&inst->inst_cache, parent))) { /* Failed to obtain parent entry's entry lock */ if(cache_retry == RETRY_CACHE_LOCK && -- 1.7.11.7