Blame SOURCES/autofs-5.0.8-pass-map_source-as-function-paramter-where-possible.patch

6bbd11
autofs-5.0.8 - pass map_source as function paramter where possible
6bbd11
6bbd11
From: Ian Kent <raven@themaw.net>
6bbd11
6bbd11
Some unnecessary complexity has been added along the way when passing
6bbd11
the map source to functions in lookup modules. Improve that where
6bbd11
possible.
6bbd11
---
6bbd11
 CHANGELOG                |    1 
6bbd11
 modules/lookup_file.c    |   82 +++++++++++++++--------------------------------
6bbd11
 modules/lookup_ldap.c    |   37 ++++++---------------
6bbd11
 modules/lookup_nisplus.c |   36 ++++----------------
6bbd11
 modules/lookup_yp.c      |   36 ++++----------------
6bbd11
 5 files changed, 56 insertions(+), 136 deletions(-)
6bbd11
6bbd11
--- autofs-5.0.7.orig/CHANGELOG
6bbd11
+++ autofs-5.0.7/CHANGELOG
6bbd11
@@ -84,6 +84,7 @@
6bbd11
 - fix cache readlock not taken on lookup.
6bbd11
 - fix compilation of lookup_ldap.c without sasl.
6bbd11
 - fix undefined authtype_requires_creds err if ldap enabled but without sasl.
6bbd11
+- pass map_source as function paramter where possible.
6bbd11
 
6bbd11
 25/07/2012 autofs-5.0.7
6bbd11
 =======================
6bbd11
--- autofs-5.0.7.orig/modules/lookup_file.c
6bbd11
+++ autofs-5.0.7/modules/lookup_file.c
6bbd11
@@ -529,21 +529,17 @@ static int check_self_include(const char
6bbd11
 
6bbd11
 static struct map_source *
6bbd11
 prepare_plus_include(struct autofs_point *ap,
6bbd11
+		     struct map_source *source,
6bbd11
 		     time_t age, char *key, unsigned int inc,
6bbd11
 		     struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *current;
6bbd11
-	struct map_source *source;
6bbd11
+	struct map_source *new;
6bbd11
 	struct map_type_info *info;
6bbd11
 	const char *argv[2];
6bbd11
 	char **tmp_argv, **tmp_opts;
6bbd11
 	int argc;
6bbd11
 	char *buf;
6bbd11
 
6bbd11
-	current = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	/*
6bbd11
 	 * TODO:
6bbd11
 	 * Initially just consider the passed in key to be a simple map
6bbd11
@@ -596,21 +592,21 @@ prepare_plus_include(struct autofs_point
6bbd11
 	}
6bbd11
 	argc += ctxt->opts_argc;
6bbd11
 
6bbd11
-	source = master_find_source_instance(current,
6bbd11
-					     info->type, info->format,
6bbd11
-					     argc, (const char **) tmp_argv);
6bbd11
-	if (source) {
6bbd11
+	new = master_find_source_instance(source,
6bbd11
+					  info->type, info->format,
6bbd11
+					  argc, (const char **) tmp_argv);
6bbd11
+	if (new) {
6bbd11
 		/*
6bbd11
 		 * Make sure included map age is in sync with its owner
6bbd11
 		 * or we could incorrectly wipe out its entries.
6bbd11
 		 */
6bbd11
-		source->age = age;
6bbd11
-		source->stale = 1;
6bbd11
+		new->age = age;
6bbd11
+		new->stale = 1;
6bbd11
 	} else {
6bbd11
-		source = master_add_source_instance(current,
6bbd11
-						    info->type, info->format, age,
6bbd11
-						    argc, (const char **) tmp_argv);
6bbd11
-		if (!source) {
6bbd11
+		new = master_add_source_instance(source,
6bbd11
+						 info->type, info->format, age,
6bbd11
+						 argc, (const char **) tmp_argv);
6bbd11
+		if (!new) {
6bbd11
 			free_argv(argc, (const char **) tmp_argv);
6bbd11
 			free_map_type_info(info);
6bbd11
 			free(buf);
6bbd11
@@ -620,14 +616,14 @@ prepare_plus_include(struct autofs_point
6bbd11
 	}
6bbd11
 	free_argv(argc, (const char **) tmp_argv);
6bbd11
 
6bbd11
-	source->depth = current->depth + 1;
6bbd11
+	new->depth = source->depth + 1;
6bbd11
 	if (inc)
6bbd11
-		source->recurse = 1;
6bbd11
+		new->recurse = 1;
6bbd11
 
6bbd11
 	free_map_type_info(info);
6bbd11
 	free(buf);
6bbd11
 
6bbd11
-	return source;
6bbd11
+	return new;
6bbd11
 }
6bbd11
 
6bbd11
 int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
6bbd11
@@ -689,10 +685,8 @@ int lookup_read_map(struct autofs_point
6bbd11
 
6bbd11
 			inc = check_self_include(key, ctxt);
6bbd11
 
6bbd11
-			master_source_current_wait(ap->entry);
6bbd11
-			ap->entry->current = source;
6bbd11
-
6bbd11
-			inc_source = prepare_plus_include(ap, age, key, inc, ctxt);
6bbd11
+			inc_source = prepare_plus_include(ap, source,
6bbd11
+							  age, key, inc, ctxt);
6bbd11
 			if (!inc_source) {
6bbd11
 				debug(ap->logopt,
6bbd11
 				      "failed to select included map %s", key);
6bbd11
@@ -731,10 +725,10 @@ int lookup_read_map(struct autofs_point
6bbd11
 }
6bbd11
 
6bbd11
 static int lookup_one(struct autofs_point *ap,
6bbd11
+		      struct map_source *source,
6bbd11
 		      const char *key, int key_len,
6bbd11
 		      struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	char mkey[KEY_MAX_LEN + 1];
6bbd11
 	char mapent[MAPENT_MAX_LEN + 1];
6bbd11
@@ -743,10 +737,6 @@ static int lookup_one(struct autofs_poin
6bbd11
 	unsigned int k_len, m_len;
6bbd11
 	int entry, ret;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
 	f = open_fopen_r(ctxt->mapname);
6bbd11
@@ -773,10 +763,8 @@ static int lookup_one(struct autofs_poin
6bbd11
 
6bbd11
 				inc = check_self_include(mkey, ctxt);
6bbd11
 
6bbd11
-				master_source_current_wait(ap->entry);
6bbd11
-				ap->entry->current = source;
6bbd11
-
6bbd11
-				inc_source = prepare_plus_include(ap, age, mkey, inc, ctxt);
6bbd11
+				inc_source = prepare_plus_include(ap, source,
6bbd11
+								  age, mkey, inc, ctxt);
6bbd11
 				if (!inc_source) {
6bbd11
 					debug(ap->logopt,
6bbd11
 					      MODPREFIX
6bbd11
@@ -837,9 +825,9 @@ static int lookup_one(struct autofs_poin
6bbd11
 	return CHE_MISSING;
6bbd11
 }
6bbd11
 
6bbd11
-static int lookup_wild(struct autofs_point *ap, struct lookup_context *ctxt)
6bbd11
+static int lookup_wild(struct autofs_point *ap,
6bbd11
+		       struct map_source *source, struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	char mkey[KEY_MAX_LEN + 1];
6bbd11
 	char mapent[MAPENT_MAX_LEN + 1];
6bbd11
@@ -848,10 +836,6 @@ static int lookup_wild(struct autofs_poi
6bbd11
 	unsigned int k_len, m_len;
6bbd11
 	int entry, ret;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
 	f = open_fopen_r(ctxt->mapname);
6bbd11
@@ -895,24 +879,17 @@ static int lookup_wild(struct autofs_poi
6bbd11
 }
6bbd11
 
6bbd11
 static int check_map_indirect(struct autofs_point *ap,
6bbd11
+			      struct map_source *source,
6bbd11
 			      char *key, int key_len,
6bbd11
 			      struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	struct mapent *exists;
6bbd11
 	int ret = CHE_OK;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
-	master_source_current_wait(ap->entry);
6bbd11
-	ap->entry->current = source;
6bbd11
-
6bbd11
-	ret = lookup_one(ap, key, key_len, ctxt);
6bbd11
+	ret = lookup_one(ap, source, key, key_len, ctxt);
6bbd11
 	if (ret == CHE_COMPLETED)
6bbd11
 		return NSS_STATUS_COMPLETED;
6bbd11
 
6bbd11
@@ -935,10 +912,7 @@ static int check_map_indirect(struct aut
6bbd11
 		struct mapent *we;
6bbd11
 		int wild = CHE_MISSING;
6bbd11
 
6bbd11
-		master_source_current_wait(ap->entry);
6bbd11
-		ap->entry->current = source;
6bbd11
-
6bbd11
-		wild = lookup_wild(ap, ctxt);
6bbd11
+		wild = lookup_wild(ap, source, ctxt);
6bbd11
 		/*
6bbd11
 		 * Check for map change and update as needed for
6bbd11
 		 * following cache lookup.
6bbd11
@@ -1072,10 +1046,8 @@ int lookup_mount(struct autofs_point *ap
6bbd11
 		if (!lkp_key)
6bbd11
 			return NSS_STATUS_UNKNOWN;
6bbd11
 
6bbd11
-		master_source_current_wait(ap->entry);
6bbd11
-		ap->entry->current = source;
6bbd11
-
6bbd11
-		status = check_map_indirect(ap, lkp_key, strlen(lkp_key), ctxt);
6bbd11
+		status = check_map_indirect(ap, source,
6bbd11
+					    lkp_key, strlen(lkp_key), ctxt);
6bbd11
 		free(lkp_key);
6bbd11
 		if (status) {
6bbd11
 			if (status == NSS_STATUS_COMPLETED)
6bbd11
--- autofs-5.0.7.orig/modules/lookup_ldap.c
6bbd11
+++ autofs-5.0.7/modules/lookup_ldap.c
6bbd11
@@ -2321,20 +2321,16 @@ next:
6bbd11
 
6bbd11
 
6bbd11
 static int read_one_map(struct autofs_point *ap,
6bbd11
+			struct map_source *source,
6bbd11
 			struct lookup_context *ctxt,
6bbd11
 			time_t age, int *result_ldap)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct ldap_search_params sp;
6bbd11
 	char buf[MAX_ERR_BUF];
6bbd11
 	char *class, *info, *entry;
6bbd11
 	char *attrs[3];
6bbd11
 	int rv, l;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	/*
6bbd11
 	 * If we don't need to create directories then there's no use
6bbd11
 	 * reading the map. We always need to read the whole map for
6bbd11
@@ -2453,11 +2449,16 @@ static int read_one_map(struct autofs_po
6bbd11
 int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
6bbd11
 {
6bbd11
 	struct lookup_context *ctxt = (struct lookup_context *) context;
6bbd11
+	struct map_source *source;
6bbd11
 	int rv = LDAP_SUCCESS;
6bbd11
 	int ret, cur_state;
6bbd11
 
6bbd11
+	source = ap->entry->current;
6bbd11
+	ap->entry->current = NULL;
6bbd11
+	master_source_current_signal(ap->entry);
6bbd11
+
6bbd11
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
6bbd11
-	ret = read_one_map(ap, ctxt, age, &rv;;
6bbd11
+	ret = read_one_map(ap, source, ctxt, age, &rv;;
6bbd11
 	if (ret != NSS_STATUS_SUCCESS) {
6bbd11
 		switch (rv) {
6bbd11
 		case LDAP_SIZELIMIT_EXCEEDED:
6bbd11
@@ -2474,10 +2475,9 @@ int lookup_read_map(struct autofs_point
6bbd11
 	return ret;
6bbd11
 }
6bbd11
 
6bbd11
-static int lookup_one(struct autofs_point *ap,
6bbd11
+static int lookup_one(struct autofs_point *ap, struct map_source *source,
6bbd11
 		char *qKey, int qKey_len, struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	int rv, i, l, ql, count;
6bbd11
 	char buf[MAX_ERR_BUF];
6bbd11
@@ -2496,10 +2496,6 @@ static int lookup_one(struct autofs_poin
6bbd11
 	unsigned int wild = 0;
6bbd11
 	int ret = CHE_MISSING;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
 	if (ctxt == NULL) {
6bbd11
@@ -2834,27 +2830,20 @@ next:
6bbd11
 }
6bbd11
 
6bbd11
 static int check_map_indirect(struct autofs_point *ap,
6bbd11
+			      struct map_source *source,
6bbd11
 			      char *key, int key_len,
6bbd11
 			      struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	struct mapent *me;
6bbd11
 	time_t now = time(NULL);
6bbd11
 	time_t t_last_read;
6bbd11
 	int ret, cur_state;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
-	master_source_current_wait(ap->entry);
6bbd11
-	ap->entry->current = source;
6bbd11
-
6bbd11
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
6bbd11
-	ret = lookup_one(ap, key, key_len, ctxt);
6bbd11
+	ret = lookup_one(ap, source, key, key_len, ctxt);
6bbd11
 	if (ret == CHE_FAIL) {
6bbd11
 		pthread_setcancelstate(cur_state, NULL);
6bbd11
 		return NSS_STATUS_NOTFOUND;
6bbd11
@@ -2974,10 +2963,8 @@ int lookup_mount(struct autofs_point *ap
6bbd11
 		if (!lkp_key)
6bbd11
 			return NSS_STATUS_UNKNOWN;
6bbd11
 
6bbd11
-		master_source_current_wait(ap->entry);
6bbd11
-		ap->entry->current = source;
6bbd11
-
6bbd11
-		status = check_map_indirect(ap, lkp_key, strlen(lkp_key), ctxt);
6bbd11
+		status = check_map_indirect(ap, source,
6bbd11
+					    lkp_key, strlen(lkp_key), ctxt);
6bbd11
 		free(lkp_key);
6bbd11
 		if (status)
6bbd11
 			return status;
6bbd11
--- autofs-5.0.7.orig/modules/lookup_nisplus.c
6bbd11
+++ autofs-5.0.7/modules/lookup_nisplus.c
6bbd11
@@ -267,10 +267,10 @@ int lookup_read_map(struct autofs_point
6bbd11
 }
6bbd11
 
6bbd11
 static int lookup_one(struct autofs_point *ap,
6bbd11
+		      struct map_source *source,
6bbd11
 		      const char *key, int key_len,
6bbd11
 		      struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	char *tablename;
6bbd11
 	nis_result *result;
6bbd11
@@ -280,10 +280,6 @@ static int lookup_one(struct autofs_poin
6bbd11
 	int ret, cur_state;
6bbd11
 	char buf[MAX_ERR_BUF];
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
6bbd11
@@ -326,9 +322,9 @@ static int lookup_one(struct autofs_poin
6bbd11
 	return ret;
6bbd11
 }
6bbd11
 
6bbd11
-static int lookup_wild(struct autofs_point *ap, struct lookup_context *ctxt)
6bbd11
+static int lookup_wild(struct autofs_point *ap,
6bbd11
+		       struct map_source *source, struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	char *tablename;
6bbd11
 	nis_result *result;
6bbd11
@@ -338,10 +334,6 @@ static int lookup_wild(struct autofs_poi
6bbd11
 	int ret, cur_state;
6bbd11
 	char buf[MAX_ERR_BUF];
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
6bbd11
@@ -383,27 +375,20 @@ static int lookup_wild(struct autofs_poi
6bbd11
 }
6bbd11
 
6bbd11
 static int check_map_indirect(struct autofs_point *ap,
6bbd11
+			      struct map_source *source,
6bbd11
 			      char *key, int key_len,
6bbd11
 			      struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	struct mapent *me, *exists;
6bbd11
 	time_t now = time(NULL);
6bbd11
 	time_t t_last_read;
6bbd11
 	int ret = 0;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
-	master_source_current_wait(ap->entry);
6bbd11
-	ap->entry->current = source;
6bbd11
-
6bbd11
 	/* check map and if change is detected re-read map */
6bbd11
-	ret = lookup_one(ap, key, key_len, ctxt);
6bbd11
+	ret = lookup_one(ap, source, key, key_len, ctxt);
6bbd11
 	if (ret == CHE_FAIL)
6bbd11
 		return NSS_STATUS_NOTFOUND;
6bbd11
 
6bbd11
@@ -452,10 +437,7 @@ static int check_map_indirect(struct aut
6bbd11
 		int wild = CHE_MISSING;
6bbd11
 		struct mapent *we;
6bbd11
 
6bbd11
-		master_source_current_wait(ap->entry);
6bbd11
-		ap->entry->current = source;
6bbd11
-
6bbd11
-		wild = lookup_wild(ap, ctxt);
6bbd11
+		wild = lookup_wild(ap, source, ctxt);
6bbd11
 		/*
6bbd11
 		 * Check for map change and update as needed for
6bbd11
 		 * following cache lookup.
6bbd11
@@ -553,10 +535,8 @@ int lookup_mount(struct autofs_point *ap
6bbd11
 		if (!lkp_key)
6bbd11
 			return NSS_STATUS_UNKNOWN;
6bbd11
 
6bbd11
-		master_source_current_wait(ap->entry);
6bbd11
-		ap->entry->current = source;
6bbd11
-
6bbd11
-		status = check_map_indirect(ap, lkp_key, strlen(lkp_key), ctxt);
6bbd11
+		status = check_map_indirect(ap, source,
6bbd11
+					    lkp_key, strlen(lkp_key), ctxt);
6bbd11
 		if (status)
6bbd11
 			return status;
6bbd11
 	}
6bbd11
--- autofs-5.0.7.orig/modules/lookup_yp.c
6bbd11
+++ autofs-5.0.7/modules/lookup_yp.c
6bbd11
@@ -377,10 +377,10 @@ int lookup_read_map(struct autofs_point
6bbd11
 }
6bbd11
 
6bbd11
 static int lookup_one(struct autofs_point *ap,
6bbd11
+		      struct map_source *source,
6bbd11
 		      const char *key, int key_len,
6bbd11
 		      struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	char *mapname;
6bbd11
 	char *mapent;
6bbd11
@@ -388,10 +388,6 @@ static int lookup_one(struct autofs_poin
6bbd11
 	time_t age = time(NULL);
6bbd11
 	int ret;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
 	mapname = alloca(strlen(ctxt->mapname) + 1);
6bbd11
@@ -436,9 +432,9 @@ static int lookup_one(struct autofs_poin
6bbd11
 	return ret;
6bbd11
 }
6bbd11
 
6bbd11
-static int lookup_wild(struct autofs_point *ap, struct lookup_context *ctxt)
6bbd11
+static int lookup_wild(struct autofs_point *ap,
6bbd11
+		       struct map_source *source, struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	char *mapname;
6bbd11
 	char *mapent;
6bbd11
@@ -446,10 +442,6 @@ static int lookup_wild(struct autofs_poi
6bbd11
 	time_t age = time(NULL);
6bbd11
 	int ret;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
 	mapname = alloca(strlen(ctxt->mapname) + 1);
6bbd11
@@ -489,26 +481,19 @@ static int lookup_wild(struct autofs_poi
6bbd11
 }
6bbd11
 
6bbd11
 static int check_map_indirect(struct autofs_point *ap,
6bbd11
+			      struct map_source *source,
6bbd11
 			      char *key, int key_len,
6bbd11
 			      struct lookup_context *ctxt)
6bbd11
 {
6bbd11
-	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	struct mapent *exists;
6bbd11
 	unsigned int map_order;
6bbd11
 	int ret = 0;
6bbd11
 
6bbd11
-	source = ap->entry->current;
6bbd11
-	ap->entry->current = NULL;
6bbd11
-	master_source_current_signal(ap->entry);
6bbd11
-
6bbd11
 	mc = source->mc;
6bbd11
 
6bbd11
-	master_source_current_wait(ap->entry);
6bbd11
-	ap->entry->current = source;
6bbd11
-
6bbd11
 	/* check map and if change is detected re-read map */
6bbd11
-	ret = lookup_one(ap, key, key_len, ctxt);
6bbd11
+	ret = lookup_one(ap, source, key, key_len, ctxt);
6bbd11
 	if (ret == CHE_FAIL)
6bbd11
 		return NSS_STATUS_NOTFOUND;
6bbd11
 
6bbd11
@@ -556,10 +541,7 @@ static int check_map_indirect(struct aut
6bbd11
 		struct mapent *we;
6bbd11
 		int wild = CHE_MISSING;
6bbd11
 
6bbd11
-		master_source_current_wait(ap->entry);
6bbd11
-		ap->entry->current = source;
6bbd11
-
6bbd11
-		wild = lookup_wild(ap, ctxt);
6bbd11
+		wild = lookup_wild(ap, source, ctxt);
6bbd11
 		/*
6bbd11
 		 * Check for map change and update as needed for
6bbd11
 		 * following cache lookup.
6bbd11
@@ -657,10 +639,8 @@ int lookup_mount(struct autofs_point *ap
6bbd11
 		if (!lkp_key)
6bbd11
 			return NSS_STATUS_UNKNOWN;
6bbd11
 
6bbd11
-		master_source_current_wait(ap->entry);
6bbd11
-		ap->entry->current = source;
6bbd11
-
6bbd11
-		status = check_map_indirect(ap, lkp_key, strlen(lkp_key), ctxt);
6bbd11
+		status = check_map_indirect(ap, source,
6bbd11
+					    lkp_key, strlen(lkp_key), ctxt);
6bbd11
 		free(lkp_key);
6bbd11
 		if (status)
6bbd11
 			return status;