From ff00b07402747aac403478a157adab75e306d7d1 Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Jan 07 2019 08:40:04 +0000 Subject: 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 --- diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c index ab794a1..b8052f9 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)) {