ebf24ff Ticket #47966 - slapd crashes during Dogtag clone reinstallation

Authored and Committed by nhosoi 9 years ago
    Ticket #47966 - slapd crashes during Dogtag clone reinstallation
    
    Bug description: There were 2 VLV index issues.
    1) When a VLV index is removed, it did not call dblayer_erase_index_file_
       nolock, which removes the physical index file as well as a back pointer
       set to the dblayer handle.  The back pointer is scanned at the backend
       close time where the garbage address is used to close the already removed
       vlv index.
    2) VLV plugin callbacks are registered in vlv_init.  The function could be
       called multiple times without unregster the VLV plugin callbacks, e.g.,
       from bulk import, which reopens the backend instance.  If create an
       instance and a vlv index, then initialize the database with bulk import,
       2 VLV index callbacks are registered.  The first set points the old instance
       address, which is already freed.
       Note: the unregister callback functions are called only when the instance
       is deleted in vlv_remove_callbacks via ldbm_instance_unregister_callbacks.
       The callback is set as the post delete plugin with "(objectclass=nsBackendInstance)".
    
    Fix description:
    1) When a VLV index is removed, it calls dblayer_erase_index_file_nolock.
    2) Before registering VLV plugin callbacks, calling unregister callbacks to
       make sure cleaning up the existing callbacks.
    
    https://fedorahosted.org/389/ticket/47966
    
    Reviewed by rmeggins@redhat.com and mreynolds@redhat.com (Thank you, Rich and Mark!!)