Bug 979170

Summary: ruv modify context problem with cache_replace
Product: Red Hat Enterprise Linux 6 Reporter: Rich Megginson <rmeggins>
Component: 389-ds-baseAssignee: Rich Megginson <rmeggins>
Status: CLOSED DUPLICATE QA Contact: Sankar Ramalingam <sramling>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: jgalipea, nkinder
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-28 19:58:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rich Megginson 2013-06-27 19:50:58 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/47404

This causes errors like this in the errors log:

ldbm_back_add: modify_switch_entries failed
and
ldbm_back_modify: modify_switch_entries failed

The problem is that the struct _modify_context->old_entry can be removed from the cache between the call to ldbm_txn_ruv_modify_context() and the call to modify_switch_entries(), by a BETXN PRE Op plugin.  Consider the following:

{{{
outer add:
ldbm_txn_ruv_modify_context:
mc->old_e = cached RUV ID = N DN = A
mc->new_e = not cached
  betxnpreop - inner mod
  ldbm_txn_ruv_modify_context:
  mc->old_e = cached RUV ID = N DN = A # points to same cache entry as above old_e
  mc->new_e = not cached
  ... do op - call modify_update_all()
  ... success ...
  modify_switch_entries - cache_replace old_e, new_e
    delete RUV ID from ID hash
    delete RUV DN from DN hash
    add new_e to RUV ID hash
    add new_e to RUV DN hash
    mark old_e as DELETED
    new_e refcnt == 1 # NOTE: should this be new_e refcnt = old_e refcnt instead?
  cache_return new_e - entrycache_return
    new_e->refcnt-- # now 0
    if (not DELETED)
      add new_e to lru list
      if (CACHE_FULL) # TRUE - cache is full
        entrycache_flush - iterate through lru list
          entrycache_remove_int new_e
            remove RUV ID from ID hash
            remove RUV DN from DN hash
            mark new_e as DELETED
            # NOTE: at this point, there is no RUV ID or DN in cache!
    backentry_free(new_e)
outer
modify_switch_entries - cache_replace old_e, new_e
  remove_hash RUV ID - FAIL
  remove_hash RUV DN - FAIL
  return 1 - FAIL
}}}
This most commonly happens with DNA as DNA is the only BETXN PREOP (in 1.2.11) that modifies the database.
After the call to the BETXN PREOP, we need to make sure mc->old_entry still points to something - not sure how best to do that.

Comment 1 Nathan Kinder 2013-06-28 19:58:10 UTC

*** This bug has been marked as a duplicate of bug 972976 ***