From 90ba52ac8f655cb5d6cfd3f201c15f8004eb8414 Mon Sep 17 00:00:00 2001
From: Thierry Bordaz <tbordaz@redhat.com>
Date: Fri, 4 Jan 2019 12:24:56 +0100
Subject: [PATCH] Ticket 50117 - after certain failed import operation,
impossible to replay an import operation
Bug Description:
At the beginning of an import, a flag is set to mark the target backend is busy.
Then import tests if there are pending operations. If such operations exist the import can not proceed and fails.
The problem is that in such case of pending operations, the import fails without resetting the busy flag.
It let the backend busy (until next reboot) and prevent new import.
Fix Description:
It needs to reset the busy flag if there are pending operations
https://pagure.io/389-ds-base/issue/50117
Reviewed by: Mark Reynolds, William Brown
Platforms tested: F27
Flag Day: no
Doc impact: no
(cherry picked from commit ff00b07402747aac403478a157adab75e306d7d1)
(cherry picked from commit 630940ec119a90c3bbfc7cd3464eb02ab779b474)
---
ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index 16b87ee6b..69a2af9cf 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -704,12 +704,22 @@ ldbm_back_ldif2ldbm(Slapi_PBlock *pb)
}
/* check if an import/restore is already ongoing... */
- if ((instance_set_busy(inst) != 0) ||
- (slapi_counter_get_value(inst->inst_ref_count) > 0)) {
+ if ((instance_set_busy(inst) != 0)) {
slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_ldif2ldbm", "ldbm: '%s' is already in the middle of "
"another task and cannot be disturbed.\n",
inst->inst_name);
return -1;
+ } else {
+ uint64_t refcnt;
+ refcnt = slapi_counter_get_value(inst->inst_ref_count);
+ if (refcnt > 0) {
+ slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_ldif2ldbm", "ldbm: '%s' there are %d pending operation(s)."
+ " Import can not proceed until they are completed.\n",
+ inst->inst_name,
+ refcnt);
+ instance_set_not_busy(inst);
+ return -1;
+ }
}
if ((task_flags & SLAPI_TASK_RUNNING_FROM_COMMANDLINE)) {
--
2.17.2