Ticket #48250 - Slapd crashes reported from latest build
Bug Description: There was a conflict between an import task and
deleting the instance. While the import task was still running,
the backend instance was removed, which should have been rejected.
Fix Description: Backend tasks keeps instance refcnt positive and
disable the backend in the mapping tree. This patch adds the
check for the mapping tree in the backend deletion callback. If
the instance refcnt is positive or the mapping tree is disabled,
the deletion is backed off.
For the backend deletion, the referral info is not needed. To
reduce unnecessary allocation and free, adding the code which
checks if the given referral variable is NULL or not to mtn_get_be.
If it is NULL, no allocation for the referral entry occurs.
Reviewed by firstname.lastname@example.org (Thank you, Rich!!)
(cherry picked from commit 01fea1f89a680358245677f72a67e9ccf196f66d)
(cherry picked from commit 7a4b0a705ec7376e704f6ae591beabf6c8f890af)