Blame SOURCES/autofs-5.1.7-remove-mounts_mutex.patch

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