Blame SOURCES/0091-IPA-Delay-the-first-periodic-refresh-of-trusted-doma.patch

9f2ebf
From a2f7322b9d8e47c0c93463d9fe1f37dc869799df Mon Sep 17 00:00:00 2001
9f2ebf
From: Jakub Hrozek <jhrozek@redhat.com>
9f2ebf
Date: Mon, 8 Jan 2018 18:30:57 +0100
9f2ebf
Subject: [PATCH 91/96] IPA: Delay the first periodic refresh of trusted
9f2ebf
 domains
9f2ebf
MIME-Version: 1.0
9f2ebf
Content-Type: text/plain; charset=UTF-8
9f2ebf
Content-Transfer-Encoding: 8bit
9f2ebf
9f2ebf
When the IPA subdomains code is initialized, the responders send a request
9f2ebf
to fetch subdomains. This request first stores the list of trusted domains
9f2ebf
to the cache and then runs the ipa-getkeytab helper.
9f2ebf
9f2ebf
At the same time, the periodical task to update the subdomains is also
9f2ebf
started. The task founds out that all the trusted domains are already known
9f2ebf
and finishes the request, which replies to the Data Provider requests as
9f2ebf
well even while the ipa-getkeytab request is still running.
9f2ebf
9f2ebf
This unblocks requests from the responders, which try to connect to the AD
9f2ebf
DCs even before the keytab is available, which switches the SSSD status to
9f2ebf
offline.
9f2ebf
9f2ebf
This patch simply delays the first periodic task in the IPA subdomains code
9f2ebf
by 10 minutes, thus mitigating the startup race.
9f2ebf
9f2ebf
Resolves:
9f2ebf
https://pagure.io/SSSD/sssd/issue/3601
9f2ebf
9f2ebf
Reviewed-by: Sumit Bose <sbose@redhat.com>
9f2ebf
Reviewed-by: Michal Židek <mzidek@redhat.com>
9f2ebf
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
9f2ebf
(cherry picked from commit 261a84355d9d033ca03f46727dbc2cf4921f154e)
9f2ebf
---
9f2ebf
 src/providers/ipa/ipa_subdomains.c | 7 ++++++-
9f2ebf
 1 file changed, 6 insertions(+), 1 deletion(-)
9f2ebf
9f2ebf
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
9f2ebf
index 3d3341a3eff5e55ae0c6fa5ad40603adc609e692..7d2cf80c8137a0428880c5474d4d94ca3ad1a5d4 100644
9f2ebf
--- a/src/providers/ipa/ipa_subdomains.c
9f2ebf
+++ b/src/providers/ipa/ipa_subdomains.c
9f2ebf
@@ -2379,6 +2379,11 @@ errno_t ipa_subdomains_init(TALLOC_CTX *mem_ctx,
9f2ebf
     struct ipa_options *ipa_options;
9f2ebf
     time_t period;
9f2ebf
     errno_t ret;
9f2ebf
+    /* Delay the first ptask that refreshes the trusted domains so that a race between
9f2ebf
+     * the first responder-induced request and the ptask doesn't cause issues, see
9f2ebf
+     * also upstream ticket #3601
9f2ebf
+     */
9f2ebf
+    const time_t ptask_first_delay = 600;
9f2ebf
 
9f2ebf
     ipa_options = ipa_id_ctx->ipa_options;
9f2ebf
 
9f2ebf
@@ -2401,7 +2406,7 @@ errno_t ipa_subdomains_init(TALLOC_CTX *mem_ctx,
9f2ebf
                   struct ipa_subdomains_ctx, struct dp_subdomains_data, struct dp_reply_std);
9f2ebf
 
9f2ebf
     period = be_ctx->domain->subdomain_refresh_interval;
9f2ebf
-    ret = be_ptask_create(sd_ctx, be_ctx, period, 0, 0, 0, period,
9f2ebf
+    ret = be_ptask_create(sd_ctx, be_ctx, period, ptask_first_delay, 0, 0, period,
9f2ebf
                           BE_PTASK_OFFLINE_DISABLE, 0,
9f2ebf
                           ipa_subdomains_ptask_send, ipa_subdomains_ptask_recv, sd_ctx,
9f2ebf
                           "Subdomains Refresh", NULL);
9f2ebf
-- 
9f2ebf
2.14.3
9f2ebf