sssd/0069-AUTOFS-Fix-offline-res...

59 lines
2.2 KiB
Diff

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