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

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