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

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