summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-08-04 17:58:32 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2016-09-21 10:12:47 +0200
commitb9e155da725e711ab306ca8a96e3ba6fbda41a3a (patch)
tree9fc60ad52e56f6fa28d6a9b2788030ea39718ee3
parentdb0982c52294ee5ea08ed242d27660783fde29cd (diff)
downloadsssd-b9e155da725e711ab306ca8a96e3ba6fbda41a3a.tar.gz
sssd-b9e155da725e711ab306ca8a96e3ba6fbda41a3a.tar.xz
sssd-b9e155da725e711ab306ca8a96e3ba6fbda41a3a.zip
AUTOFS: Fix offline resolution of autofs maps
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>
-rw-r--r--src/responder/autofs/autofssrv_cmd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/responder/autofs/autofssrv_cmd.c b/src/responder/autofs/autofssrv_cmd.c
index 9666ab2d1..f5aa25a48 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) {