Blame SOURCES/autofs-5.1.1-change-lookup-to-use-reinit-instead-of-reopen.patch

304803
autofs-5.1.1 - change lookup to use reinit instead of reopen
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
When a HUP signal is received lookup module are cloed and then re-opened.
304803
This can occassionally cause a problem with library data segemets and
304803
lead to a SEGV.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG       |    1 +
304803
 daemon/lookup.c |   32 +++++++++++++++++++++-----------
304803
 2 files changed, 22 insertions(+), 11 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -195,6 +195,7 @@
304803
 - fix gcc5 complaints.
304803
 - fix missing source sss in multi map lookup.
304803
 - fix update_hosts_mounts() return.
304803
+- change lookup to use reinit instead of reopen.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/daemon/lookup.c
304803
+++ autofs-5.0.7/daemon/lookup.c
304803
@@ -300,17 +300,27 @@ static int do_read_map(struct autofs_poi
304803
 	struct lookup_mod *lookup;
304803
 	int status;
304803
 
304803
-	status = open_lookup(map->type, "", map->format,
304803
-			     map->argc, map->argv, &lookup);
304803
-	if (status != NSS_STATUS_SUCCESS) {
304803
-		debug(ap->logopt, "lookup module %s failed", map->type);
304803
-		return status;
304803
-	}
304803
-
304803
+	lookup = NULL;
304803
 	master_source_writelock(ap->entry);
304803
-	if (map->lookup)
304803
-		close_lookup(map->lookup);
304803
-	map->lookup = lookup;
304803
+	if (!map->lookup) {
304803
+		status = open_lookup(map->type, "", map->format,
304803
+				     map->argc, map->argv, &lookup);
304803
+		if (status != NSS_STATUS_SUCCESS) {
304803
+			master_source_unlock(ap->entry);
304803
+			debug(ap->logopt,
304803
+			      "lookup module %s open failed", map->type);
304803
+			return status;
304803
+		}
304803
+		map->lookup = lookup;
304803
+	} else {
304803
+		lookup = map->lookup;
304803
+		status = lookup->lookup_reinit(map->format,
304803
+					       map->argc, map->argv,
304803
+					       &lookup->context);
304803
+		if (status)
304803
+			warn(ap->logopt,
304803
+			     "lookup module %s reinit failed", map->type);
304803
+	}
304803
 	master_source_unlock(ap->entry);
304803
 
304803
 	if (!map->stale)
304803
@@ -742,7 +752,7 @@ int do_lookup_mount(struct autofs_point
304803
 				     map->format, map->argc, map->argv, &lookup);
304803
 		if (status != NSS_STATUS_SUCCESS) {
304803
 			debug(ap->logopt,
304803
-			      "lookup module %s failed", map->type);
304803
+			      "lookup module %s open failed", map->type);
304803
 			return status;
304803
 		}
304803
 		map->lookup = lookup;