beb904
autofs-5.1.7 - remove mounts_mutex
beb904
beb904
From: Ian Kent <raven@themaw.net>
beb904
beb904
The mounts_mutex is no longer used, remove it.
beb904
beb904
Signed-off-by: Ian Kent <raven@themaw.net>
beb904
---
beb904
 CHANGELOG              |    1 +
beb904
 daemon/automount.c     |    8 +-------
beb904
 daemon/master.c        |   13 -------------
beb904
 include/automount.h    |    1 -
beb904
 modules/mount_autofs.c |    8 --------
beb904
 5 files changed, 2 insertions(+), 29 deletions(-)
beb904
beb904
--- autofs-5.1.4.orig/CHANGELOG
beb904
+++ autofs-5.1.4/CHANGELOG
beb904
@@ -48,6 +48,7 @@
beb904
 - remove unused function master_submount_list_empty().
beb904
 - move amd mounts removal into lib/mounts.c.
beb904
 - check for offset with no mount location.
beb904
+- remove mounts_mutex.
beb904
 
beb904
 xx/xx/2018 autofs-5.1.5
beb904
 - fix flag file permission.
beb904
--- autofs-5.1.4.orig/daemon/automount.c
beb904
+++ autofs-5.1.4/daemon/automount.c
beb904
@@ -1749,7 +1749,6 @@ static void handle_mounts_cleanup(void *
beb904
 	 * here.
beb904
 	 */
beb904
 	if (submount) {
beb904
-		mounts_mutex_unlock(ap->parent);
beb904
 		master_source_unlock(ap->parent->entry);
beb904
 		master_free_mapent_sources(ap->entry, 1);
beb904
 		master_free_mapent(ap->entry);
beb904
@@ -1787,13 +1786,9 @@ static int submount_source_writelock_nes
beb904
 	if (status)
beb904
 		goto done;
beb904
 
beb904
-	mounts_mutex_lock(parent);
beb904
-
beb904
 	status = pthread_rwlock_trywrlock(&ap->entry->source_lock);
beb904
-	if (status) {
beb904
-		mounts_mutex_unlock(parent);
beb904
+	if (status)
beb904
 		master_source_unlock(parent->entry);
beb904
-	}
beb904
 
beb904
 done:
beb904
 	if (status && status != EBUSY) {
beb904
@@ -1809,7 +1804,6 @@ static void submount_source_unlock_neste
beb904
 	struct autofs_point *parent = ap->parent;
beb904
 
beb904
 	master_source_unlock(ap->entry);
beb904
-	mounts_mutex_unlock(parent);
beb904
 	master_source_unlock(parent->entry);
beb904
 }
beb904
 
beb904
--- autofs-5.1.4.orig/daemon/master.c
beb904
+++ autofs-5.1.4/daemon/master.c
beb904
@@ -69,7 +69,6 @@ int master_add_autofs_point(struct maste
beb904
 			    unsigned nobind, unsigned ghost, int submount)
beb904
 {
beb904
 	struct autofs_point *ap;
beb904
-	int status;
beb904
 
beb904
 	ap = malloc(sizeof(struct autofs_point));
beb904
 	if (!ap)
beb904
@@ -128,12 +127,6 @@ int master_add_autofs_point(struct maste
beb904
 	INIT_LIST_HEAD(&ap->amdmounts);
beb904
 	ap->shutdown = 0;
beb904
 
beb904
-	status = pthread_mutex_init(&ap->mounts_mutex, NULL);
beb904
-	if (status) {
beb904
-		free(ap->path);
beb904
-		free(ap);
beb904
-		return 0;
beb904
-	}
beb904
 	ap->mode = 0;
beb904
 
beb904
 	entry->ap = ap;
beb904
@@ -143,17 +136,11 @@ int master_add_autofs_point(struct maste
beb904
 
beb904
 void master_free_autofs_point(struct autofs_point *ap)
beb904
 {
beb904
-	int status;
beb904
-
beb904
 	if (!ap)
beb904
 		return;
beb904
 
beb904
 	mnts_remove_amdmounts(ap);
beb904
 
beb904
-	status = pthread_mutex_destroy(&ap->mounts_mutex);
beb904
-	if (status)
beb904
-		fatal(status);
beb904
-
beb904
 	if (ap->pref)
beb904
 		free(ap->pref);
beb904
 	free(ap->path);
beb904
--- autofs-5.1.4.orig/include/automount.h
beb904
+++ autofs-5.1.4/include/automount.h
beb904
@@ -564,7 +564,6 @@ struct autofs_point {
beb904
 	enum states state;		/* Current state */
beb904
 	int state_pipe[2];		/* State change router pipe */
beb904
 	struct autofs_point *parent;	/* Owner of mounts list for submount */
beb904
-	pthread_mutex_t mounts_mutex;	/* Protect mount lists */
beb904
 	struct list_head mounts;	/* List of autofs mounts at current level */
beb904
 	unsigned int submount;		/* Is this a submount */
beb904
 	unsigned int submnt_count;	/* Number of submounts */
beb904
--- autofs-5.1.4.orig/modules/mount_autofs.c
beb904
+++ autofs-5.1.4/modules/mount_autofs.c
beb904
@@ -283,8 +283,6 @@ int mount_mount(struct autofs_point *ap,
beb904
 	set_exp_timeout(nap, NULL, timeout);
beb904
 	nap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
beb904
 
beb904
-	mounts_mutex_lock(ap);
beb904
-
beb904
 	if (source->flags & MAP_FLAG_FORMAT_AMD) {
beb904
 		struct mnt_list *mnt;
beb904
 
beb904
@@ -305,7 +303,6 @@ int mount_mount(struct autofs_point *ap,
beb904
 	if (handle_mounts_startup_cond_init(&suc)) {
beb904
 		crit(ap->logopt, MODPREFIX
beb904
 		     "failed to init startup cond for mount %s", entry->path);
beb904
-		mounts_mutex_unlock(ap);
beb904
 		master_free_map_source(source, 1);
beb904
 		master_free_mapent(entry);
beb904
 		return 1;
beb904
@@ -316,7 +313,6 @@ int mount_mount(struct autofs_point *ap,
beb904
 		crit(ap->logopt,
beb904
 		     MODPREFIX "failed to allocate mount %s", realpath);
beb904
 		handle_mounts_startup_cond_destroy(&suc);
beb904
-		mounts_mutex_unlock(ap);
beb904
 		master_free_map_source(source, 1);
beb904
 		master_free_mapent(entry);
beb904
 		return 1;
beb904
@@ -335,7 +331,6 @@ int mount_mount(struct autofs_point *ap,
beb904
 		     realpath);
beb904
 		handle_mounts_startup_cond_destroy(&suc);
beb904
 		mnts_remove_submount(nap->path);
beb904
-		mounts_mutex_unlock(ap);
beb904
 		master_free_map_source(source, 1);
beb904
 		master_free_mapent(entry);
beb904
 		return 1;
beb904
@@ -346,7 +341,6 @@ int mount_mount(struct autofs_point *ap,
beb904
 		if (status) {
beb904
 			handle_mounts_startup_cond_destroy(&suc);
beb904
 			mnts_remove_submount(nap->path);
beb904
-			mounts_mutex_unlock(ap);
beb904
 			master_free_map_source(source, 1);
beb904
 			master_free_mapent(entry);
beb904
 			fatal(status);
beb904
@@ -358,7 +352,6 @@ int mount_mount(struct autofs_point *ap,
beb904
 		     MODPREFIX "failed to create submount for %s", realpath);
beb904
 		handle_mounts_startup_cond_destroy(&suc);
beb904
 		mnts_remove_submount(nap->path);
beb904
-		mounts_mutex_unlock(ap);
beb904
 		master_free_map_source(source, 1);
beb904
 		master_free_mapent(entry);
beb904
 		return 1;
beb904
@@ -368,7 +361,6 @@ int mount_mount(struct autofs_point *ap,
beb904
 	ap->submnt_count++;
beb904
 
beb904
 	handle_mounts_startup_cond_destroy(&suc);
beb904
-	mounts_mutex_unlock(ap);
beb904
 
beb904
 	return 0;
beb904
 }