Blame SOURCES/0155-AUTOFS-Fix-offline-resolution-of-autofs-maps.patch

45d81b
From 3f911325b21c53d3a932c48bc1bac328ec716268 Mon Sep 17 00:00:00 2001
45d81b
From: Jakub Hrozek <jhrozek@redhat.com>
45d81b
Date: Thu, 4 Aug 2016 17:58:32 +0200
45d81b
Subject: [PATCH 155/155] AUTOFS: Fix offline resolution of autofs maps
45d81b
MIME-Version: 1.0
45d81b
Content-Type: text/plain; charset=UTF-8
45d81b
Content-Transfer-Encoding: 8bit
45d81b
45d81b
If talking to the Data Provider failed, we never re-tried looking into
45d81b
the cache. We should consult the cache on DP failures and return cached
45d81b
results, if possible.
45d81b
45d81b
Resolves:
45d81b
https://fedorahosted.org/sssd/ticket/3080
45d81b
45d81b
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
45d81b
---
45d81b
 src/responder/autofs/autofssrv_cmd.c | 16 ++++++++++++----
45d81b
 1 file changed, 12 insertions(+), 4 deletions(-)
45d81b
45d81b
diff --git a/src/responder/autofs/autofssrv_cmd.c b/src/responder/autofs/autofssrv_cmd.c
45d81b
index 9666ab2d195a581f18eaa7ff9bbc4c8167a71b15..f5aa25a483c3b3352f40e8cc66dfd3a24a60af0d 100644
45d81b
--- a/src/responder/autofs/autofssrv_cmd.c
45d81b
+++ b/src/responder/autofs/autofssrv_cmd.c
45d81b
@@ -871,17 +871,25 @@ static void lookup_automntmap_cache_updated(uint16_t err_maj, uint32_t err_min,
45d81b
     if (err_maj) {
45d81b
         DEBUG(SSSDBG_CRIT_FAILURE,
45d81b
               "Unable to get information from Data Provider\n"
45d81b
-               "Error: %u, %u, %s\n"
45d81b
-               "Will try to return what we have in cache\n",
45d81b
+              "Error: %u, %u, %s\n"
45d81b
+              "Will try to return what we have in cache\n",
45d81b
                (unsigned int)err_maj, (unsigned int)err_min, err_msg);
45d81b
-        /* Loop to the next domain if possible */
45d81b
+
45d81b
+        /* Try to fall back to cache */
45d81b
+        ret = lookup_automntmap_step(lookup_ctx);
45d81b
+        if (ret == EOK) {
45d81b
+            /* We have cached results to return */
45d81b
+            autofs_setent_notify(lookup_ctx->map, ret);
45d81b
+            return;
45d81b
+        }
45d81b
+
45d81b
+        /* Otherwise try the next domain */
45d81b
         if (dctx->cmd_ctx->check_next
45d81b
                 && (dctx->domain = get_next_domain(dctx->domain, 0))) {
45d81b
             dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider);
45d81b
         }
45d81b
     }
45d81b
 
45d81b
-    /* ok the backend returned, search to see if we have updated results */
45d81b
     ret = lookup_automntmap_step(lookup_ctx);
45d81b
     if (ret != EOK) {
45d81b
         if (ret == EAGAIN) {
45d81b
-- 
45d81b
2.7.4
45d81b