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

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