diff options
author | Pavel Březina <pbrezina@redhat.com> | 2016-08-24 14:21:12 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-09-22 09:25:18 +0200 |
commit | 03cb5ac6aa4c60d2c64c6fdc2daae656bf5493f4 (patch) | |
tree | 2d22b40f9740c8e639e038c48538100e73bdb18f | |
parent | 6ad1f2da4055e2cfe9bf8c79b79e408dba171691 (diff) | |
download | sssd-03cb5ac6aa4c60d2c64c6fdc2daae656bf5493f4.tar.gz sssd-03cb5ac6aa4c60d2c64c6fdc2daae656bf5493f4.tar.xz sssd-03cb5ac6aa4c60d2c64c6fdc2daae656bf5493f4.zip |
failover: proceed normally when no new server is found
Multiple failover requests come in same time, the first one will
result in collapsing the meta server but multiple resolution of
SRV records are triggered. The first one finishes normally but the
others won't find any new server thus ends with an error.
This patch makes failover to proceed normally even in such case.
Resolves:
https://fedorahosted.org/sssd/ticket/3131
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
-rw-r--r-- | src/providers/fail_over.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c index 8ab39f27f..770840988 100644 --- a/src/providers/fail_over.c +++ b/src/providers/fail_over.c @@ -1112,7 +1112,9 @@ fo_resolve_service_cont(struct tevent_req *subreq) ret = resolve_srv_recv(subreq, &state->server); talloc_zfree(subreq); - if (ret) { + /* We will proceed normally on ERR_SRV_DUPLICATES and if the server + * is already being resolved, we hook to that request. */ + if (ret != EOK && ret != ERR_SRV_DUPLICATES) { tevent_req_error(req, ret); return; } @@ -1398,11 +1400,23 @@ resolve_srv_done(struct tevent_req *subreq) } if (last_server == state->meta) { - /* SRV lookup returned only those servers - * that are already present. */ + /* SRV lookup returned only those servers that are already present. + * This may happen only when an ongoing SRV resolution already + * exist. We will return server, but won't set any state. */ DEBUG(SSSDBG_TRACE_FUNC, "SRV lookup did not return " "any new server.\n"); ret = ERR_SRV_DUPLICATES; + + /* Since no new server is returned, state->meta->next is NULL. + * We return last tried server if possible which is server + * from previous resolution of SRV record, and first server + * otherwise. */ + if (state->service->last_tried_server != NULL) { + state->out = state->service->last_tried_server; + goto done; + } + + state->out = state->service->server_list; goto done; } @@ -1438,7 +1452,10 @@ resolve_srv_done(struct tevent_req *subreq) } done: - if (ret != EOK) { + if (ret == ERR_SRV_DUPLICATES) { + tevent_req_error(req, ret); + return; + } else if (ret != EOK) { state->out = state->meta; set_srv_data_status(state->meta->srv_data, SRV_RESOLVE_ERROR); tevent_req_error(req, ret); |