Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 272801 Details for
Bug 404231
CRM #1598404 Automount process shuts down unexpectedly
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch to improve server not available handling
autofs-5.0.2-improve-server-unavail.patch (text/plain), 6.15 KB, created by
Ian Kent
on 2007-11-29 11:00:56 UTC
(
hide
)
Description:
Patch to improve server not available handling
Filename:
MIME Type:
Creator:
Ian Kent
Created:
2007-11-29 11:00:56 UTC
Size:
6.15 KB
patch
obsolete
>diff --git a/daemon/lookup.c b/daemon/lookup.c >index 0be10d3..eb72411 100644 >--- a/daemon/lookup.c >+++ b/daemon/lookup.c >@@ -298,8 +298,6 @@ static int do_read_map(struct autofs_point *ap, struct map_source *map, time_t a > > status = lookup->lookup_read_map(ap, age, lookup->context); > >- map->stale = 0; >- > /* > * For maps that don't support enumeration return success > * and do whatever we must to have autofs function with an >@@ -533,6 +531,10 @@ int lookup_nss_read_map(struct autofs_point *ap, struct map_source *source, time > if (result == NSS_STATUS_UNKNOWN) > continue; > >+ /* Don't try to update the map cache if it's unavailable */ >+ if (result == NSS_STATUS_UNAVAIL) >+ map->stale = 0; >+ > if (result == NSS_STATUS_SUCCESS) { > at_least_one = 1; > result = NSS_STATUS_TRYAGAIN; >@@ -553,7 +555,7 @@ int lookup_nss_read_map(struct autofs_point *ap, struct map_source *source, time > } > pthread_cleanup_pop(1); > >- if (!result || at_least_one) >+ if (!result || at_least_one) > return 1; > > return 0; >diff --git a/daemon/state.c b/daemon/state.c >index cf07aac..5bccfef 100644 >--- a/daemon/state.c >+++ b/daemon/state.c >@@ -432,6 +432,7 @@ static void *do_readmap(void *arg) > me = cache_enumerate(mc, me); > } > pthread_cleanup_pop(1); >+ map->stale = 0; > map = map->next; > } > pthread_cleanup_pop(1); >diff --git a/include/automount.h b/include/automount.h >index fa5cd97..133fd32 100644 >--- a/include/automount.h >+++ b/include/automount.h >@@ -121,6 +121,7 @@ struct autofs_point; > #define CHE_MISSING 0x0008 > #define CHE_COMPLETED 0x0010 > #define CHE_DUPLICATE 0x0020 >+#define CHE_UNAVAIL 0x0040 > > #define HASHSIZE 77 > #define NEGATIVE_TIMEOUT 10 >diff --git a/modules/lookup_file.c b/modules/lookup_file.c >index 550bf5c..a77068a 100644 >--- a/modules/lookup_file.c >+++ b/modules/lookup_file.c >@@ -469,11 +469,14 @@ int lookup_read_master(struct master *master, time_t age, void *context) > master->recurse = 1;; > master->depth++; > status = lookup_nss_read_master(master, age); >- if (!status) >+ if (!status) { > warn(logopt, > MODPREFIX > "failed to read included master map %s", > master->name); >+ fclose(f); >+ return NSS_STATUS_UNAVAIL; >+ } > master->depth--; > master->recurse = 0; > >@@ -484,6 +487,7 @@ int lookup_read_master(struct master *master, time_t age, void *context) > if (!buffer) { > error(logopt, > MODPREFIX "could not malloc parse buffer"); >+ fclose(f); > return NSS_STATUS_UNAVAIL; > } > memset(buffer, 0, blen); >@@ -721,9 +725,12 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) > > /* Gim'ee some o' that 16k stack baby !! */ > status = lookup_nss_read_map(ap, inc_source, age); >- if (!status) >+ if (!status) { > warn(ap->logopt, > "failed to read included map %s", key); >+ fclose(f); >+ return NSS_STATUS_UNAVAIL; >+ } > } else { > char *s_key; > >diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c >index b8484a2..bb6ec96 100644 >--- a/modules/lookup_ldap.c >+++ b/modules/lookup_ldap.c >@@ -1755,7 +1755,7 @@ static int lookup_one(struct autofs_point *ap, > /* Initialize the LDAP context. */ > ldap = do_reconnect(ap->logopt, ctxt); > if (!ldap) >- return CHE_FAIL; >+ return CHE_UNAVAIL; > > debug(ap->logopt, > MODPREFIX "searching for \"%s\" under \"%s\"", query, ctxt->qdn); >@@ -1999,6 +1999,21 @@ static int check_map_indirect(struct autofs_point *ap, > if (ret == CHE_FAIL) { > pthread_setcancelstate(cur_state, NULL); > return NSS_STATUS_NOTFOUND; >+ } else if (ret == CHE_UNAVAIL) { >+ /* >+ * If the server is down and the entry exists in the cache >+ * and belongs to this map return success and use the entry. >+ */ >+ struct mapent *exists = cache_lookup_distinct(mc, key); >+ if (exists && exists->source == source) { >+ pthread_setcancelstate(cur_state, NULL); >+ return NSS_STATUS_SUCCESS; >+ } >+ >+ warn(ap->logopt, >+ MODPREFIX "lookup for %s failed: connection failed", key); >+ >+ return NSS_STATUS_UNAVAIL; > } > pthread_setcancelstate(cur_state, NULL); > >diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c >index fee8b16..1d13510 100644 >--- a/modules/lookup_nisplus.c >+++ b/modules/lookup_nisplus.c >@@ -385,9 +385,18 @@ static int check_map_indirect(struct autofs_point *ap, > return NSS_STATUS_NOTFOUND; > > if (ret < 0) { >+ /* >+ * If the server is down and the entry exists in the cache >+ * and belongs to this map return success and use the entry. >+ */ >+ exists = cache_lookup_distinct(mc, key); >+ if (exists && exists->source == source) >+ return NSS_STATUS_SUCCESS; >+ > warn(ap->logopt, > MODPREFIX "lookup for %s failed: %s", > key, nis_sperrno(-ret)); >+ > return NSS_STATUS_UNAVAIL; > } > >diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c >index 5f4f95f..1f7513e 100644 >--- a/modules/lookup_yp.c >+++ b/modules/lookup_yp.c >@@ -232,6 +232,8 @@ int lookup_read_master(struct master *master, time_t age, void *context) > err = yp_all((char *) ctxt->domainname, mapname, &ypcb); > } > >+ debug(logopt, "err %d", err); >+ > if (err == YPERR_SUCCESS) > return NSS_STATUS_SUCCESS; > >@@ -239,6 +241,9 @@ int lookup_read_master(struct master *master, time_t age, void *context) > MODPREFIX "read of master map %s failed: %s", > mapname, yperr_string(err)); > >+ if (err == YPERR_PMAP || err == YPERR_YPSERV) >+ return NSS_STATUS_UNAVAIL; >+ > return NSS_STATUS_NOTFOUND; > } > >@@ -336,6 +341,9 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) > MODPREFIX "read of map %s failed: %s", > ap->path, yperr_string(err)); > >+ if (err == YPERR_PMAP || err == YPERR_YPSERV) >+ return NSS_STATUS_UNAVAIL; >+ > return NSS_STATUS_NOTFOUND; > } > >@@ -481,9 +489,18 @@ static int check_map_indirect(struct autofs_point *ap, > return NSS_STATUS_NOTFOUND; > > if (ret < 0) { >+ /* >+ * If the server is down and the entry exists in the cache >+ * and belongs to this map return success and use the entry. >+ */ >+ exists = cache_lookup_distinct(mc, key); >+ if (exists && exists->source == source) >+ return NSS_STATUS_SUCCESS; >+ > warn(ap->logopt, > MODPREFIX "lookup for %s failed: %s", > key, yperr_string(-ret)); >+ > return NSS_STATUS_UNAVAIL; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 404231
: 272801