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

96dc52
autofs-5.1.7 - remove mounts_mutex
96dc52
96dc52
From: Ian Kent <raven@themaw.net>
96dc52
96dc52
The mounts_mutex is no longer used, remove it.
96dc52
96dc52
Signed-off-by: Ian Kent <raven@themaw.net>
96dc52
---
96dc52
 CHANGELOG              |    1 +
96dc52
 daemon/automount.c     |    8 +-------
96dc52
 daemon/master.c        |   13 -------------
96dc52
 include/automount.h    |    1 -
96dc52
 modules/mount_autofs.c |    8 --------
96dc52
 5 files changed, 2 insertions(+), 29 deletions(-)
96dc52
96dc52
diff --git a/CHANGELOG b/CHANGELOG
96dc52
index 42914160..9d0f4278 100644
96dc52
--- a/CHANGELOG
96dc52
+++ b/CHANGELOG
96dc52
@@ -48,6 +48,7 @@
96dc52
 - remove unused function master_submount_list_empty().
96dc52
 - move amd mounts removal into lib/mounts.c.
96dc52
 - check for offset with no mount location.
96dc52
+- remove mounts_mutex.
96dc52
 
96dc52
 25/01/2021 autofs-5.1.7
96dc52
 - make bind mounts propagation slave by default.
96dc52
diff --git a/daemon/automount.c b/daemon/automount.c
96dc52
index 7833dfae..28c4d1ee 100644
96dc52
--- a/daemon/automount.c
96dc52
+++ b/daemon/automount.c
96dc52
@@ -1754,7 +1754,6 @@ static void handle_mounts_cleanup(void *arg)
96dc52
 	 * here.
96dc52
 	 */
96dc52
 	if (submount) {
96dc52
-		mounts_mutex_unlock(ap->parent);
96dc52
 		master_source_unlock(ap->parent->entry);
96dc52
 		master_free_mapent_sources(ap->entry, 1);
96dc52
 		master_free_mapent(ap->entry);
96dc52
@@ -1792,13 +1791,9 @@ static int submount_source_writelock_nested(struct autofs_point *ap)
96dc52
 	if (status)
96dc52
 		goto done;
96dc52
 
96dc52
-	mounts_mutex_lock(parent);
96dc52
-
96dc52
 	status = pthread_rwlock_trywrlock(&ap->entry->source_lock);
96dc52
-	if (status) {
96dc52
-		mounts_mutex_unlock(parent);
96dc52
+	if (status)
96dc52
 		master_source_unlock(parent->entry);
96dc52
-	}
96dc52
 
96dc52
 done:
96dc52
 	if (status && status != EBUSY) {
96dc52
@@ -1814,7 +1809,6 @@ static void submount_source_unlock_nested(struct autofs_point *ap)
96dc52
 	struct autofs_point *parent = ap->parent;
96dc52
 
96dc52
 	master_source_unlock(ap->entry);
96dc52
-	mounts_mutex_unlock(parent);
96dc52
 	master_source_unlock(parent->entry);
96dc52
 }
96dc52
 
96dc52
diff --git a/daemon/master.c b/daemon/master.c
96dc52
index b288e070..30d7cf98 100644
96dc52
--- a/daemon/master.c
96dc52
+++ b/daemon/master.c
96dc52
@@ -69,7 +69,6 @@ int master_add_autofs_point(struct master_mapent *entry, unsigned logopt,
96dc52
 			    unsigned nobind, unsigned ghost, int submount)
96dc52
 {
96dc52
 	struct autofs_point *ap;
96dc52
-	int status;
96dc52
 
96dc52
 	ap = malloc(sizeof(struct autofs_point));
96dc52
 	if (!ap)
96dc52
@@ -128,12 +127,6 @@ int master_add_autofs_point(struct master_mapent *entry, unsigned logopt,
96dc52
 	INIT_LIST_HEAD(&ap->amdmounts);
96dc52
 	ap->shutdown = 0;
96dc52
 
96dc52
-	status = pthread_mutex_init(&ap->mounts_mutex, NULL);
96dc52
-	if (status) {
96dc52
-		free(ap->path);
96dc52
-		free(ap);
96dc52
-		return 0;
96dc52
-	}
96dc52
 	ap->mode = 0;
96dc52
 
96dc52
 	entry->ap = ap;
96dc52
@@ -143,17 +136,11 @@ int master_add_autofs_point(struct master_mapent *entry, unsigned logopt,
96dc52
 
96dc52
 void master_free_autofs_point(struct autofs_point *ap)
96dc52
 {
96dc52
-	int status;
96dc52
-
96dc52
 	if (!ap)
96dc52
 		return;
96dc52
 
96dc52
 	mnts_remove_amdmounts(ap);
96dc52
 
96dc52
-	status = pthread_mutex_destroy(&ap->mounts_mutex);
96dc52
-	if (status)
96dc52
-		fatal(status);
96dc52
-
96dc52
 	if (ap->pref)
96dc52
 		free(ap->pref);
96dc52
 	free(ap->path);
96dc52
diff --git a/include/automount.h b/include/automount.h
96dc52
index e33ee8d2..51a0bf0e 100644
96dc52
--- a/include/automount.h
96dc52
+++ b/include/automount.h
96dc52
@@ -565,7 +565,6 @@ struct autofs_point {
96dc52
 	enum states state;		/* Current state */
96dc52
 	int state_pipe[2];		/* State change router pipe */
96dc52
 	struct autofs_point *parent;	/* Owner of mounts list for submount */
96dc52
-	pthread_mutex_t mounts_mutex;	/* Protect mount lists */
96dc52
 	struct list_head mounts;	/* List of autofs mounts at current level */
96dc52
 	unsigned int submount;		/* Is this a submount */
96dc52
 	unsigned int submnt_count;	/* Number of submounts */
96dc52
diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c
96dc52
index 1c40e27a..0bcbb343 100644
96dc52
--- a/modules/mount_autofs.c
96dc52
+++ b/modules/mount_autofs.c
96dc52
@@ -283,8 +283,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
96dc52
 	set_exp_timeout(nap, NULL, timeout);
96dc52
 	nap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
96dc52
 
96dc52
-	mounts_mutex_lock(ap);
96dc52
-
96dc52
 	if (source->flags & MAP_FLAG_FORMAT_AMD) {
96dc52
 		struct mnt_list *mnt;
96dc52
 
96dc52
@@ -305,7 +303,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
96dc52
 	if (handle_mounts_startup_cond_init(&suc)) {
96dc52
 		crit(ap->logopt, MODPREFIX
96dc52
 		     "failed to init startup cond for mount %s", entry->path);
96dc52
-		mounts_mutex_unlock(ap);
96dc52
 		master_free_map_source(source, 1);
96dc52
 		master_free_mapent(entry);
96dc52
 		return 1;
96dc52
@@ -316,7 +313,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
96dc52
 		crit(ap->logopt,
96dc52
 		     MODPREFIX "failed to allocate mount %s", realpath);
96dc52
 		handle_mounts_startup_cond_destroy(&suc);
96dc52
-		mounts_mutex_unlock(ap);
96dc52
 		master_free_map_source(source, 1);
96dc52
 		master_free_mapent(entry);
96dc52
 		return 1;
96dc52
@@ -335,7 +331,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
96dc52
 		     realpath);
96dc52
 		handle_mounts_startup_cond_destroy(&suc);
96dc52
 		mnts_remove_submount(nap->path);
96dc52
-		mounts_mutex_unlock(ap);
96dc52
 		master_free_map_source(source, 1);
96dc52
 		master_free_mapent(entry);
96dc52
 		return 1;
96dc52
@@ -346,7 +341,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
96dc52
 		if (status) {
96dc52
 			handle_mounts_startup_cond_destroy(&suc);
96dc52
 			mnts_remove_submount(nap->path);
96dc52
-			mounts_mutex_unlock(ap);
96dc52
 			master_free_map_source(source, 1);
96dc52
 			master_free_mapent(entry);
96dc52
 			fatal(status);
96dc52
@@ -358,7 +352,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
96dc52
 		     MODPREFIX "failed to create submount for %s", realpath);
96dc52
 		handle_mounts_startup_cond_destroy(&suc);
96dc52
 		mnts_remove_submount(nap->path);
96dc52
-		mounts_mutex_unlock(ap);
96dc52
 		master_free_map_source(source, 1);
96dc52
 		master_free_mapent(entry);
96dc52
 		return 1;
96dc52
@@ -368,7 +361,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
96dc52
 	ap->submnt_count++;
96dc52
 
96dc52
 	handle_mounts_startup_cond_destroy(&suc);
96dc52
-	mounts_mutex_unlock(ap);
96dc52
 
96dc52
 	return 0;
96dc52
 }