Blame SOURCES/autofs-5.1.7-remove-unused-mount-offset-list-lock-functions.patch

96dc52
autofs-5.1.7 - remove unused mount offset list lock functions
96dc52
96dc52
From: Ian Kent <raven@themaw.net>
96dc52
96dc52
When fixing the locking in parse_mount() it was evident that there was
96dc52
no real benefit of having an additional lock for the offset list so its
96dc52
use was eliminated.
96dc52
96dc52
Signed-off-by: Ian Kent <raven@themaw.net>
96dc52
---
96dc52
 CHANGELOG           |    1 +
96dc52
 include/automount.h |    4 ---
96dc52
 lib/cache.c         |   70 +--------------------------------------------------
96dc52
 3 files changed, 3 insertions(+), 72 deletions(-)
96dc52
96dc52
diff --git a/CHANGELOG b/CHANGELOG
96dc52
index d25b19c8..c5619d2e 100644
96dc52
--- a/CHANGELOG
96dc52
+++ b/CHANGELOG
96dc52
@@ -19,6 +19,7 @@
96dc52
 - fix return from umount_subtree_mounts() on offset list delete.
96dc52
 - pass mapent_cache to update_offset_entry().
96dc52
 - fix inconsistent locking in parse_mount().
96dc52
+- remove unused mount offset list lock functions.
96dc52
 
96dc52
 25/01/2021 autofs-5.1.7
96dc52
 - make bind mounts propagation slave by default.
96dc52
diff --git a/include/automount.h b/include/automount.h
96dc52
index 09d84f05..69445b92 100644
96dc52
--- a/include/automount.h
96dc52
+++ b/include/automount.h
96dc52
@@ -162,7 +162,6 @@ struct stack {
96dc52
 struct mapent {
96dc52
 	struct mapent *next;
96dc52
 	struct list_head ino_index;
96dc52
-	pthread_rwlock_t multi_rwlock;
96dc52
 	struct list_head multi_list;
96dc52
 	struct mapent_cache *mc;
96dc52
 	struct map_source *source;
96dc52
@@ -212,9 +211,6 @@ int cache_set_offset_parent(struct mapent_cache *mc, const char *offset);
96dc52
 int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age);
96dc52
 int cache_delete(struct mapent_cache *mc, const char *key);
96dc52
 int cache_delete_offset(struct mapent_cache *mc, const char *key);
96dc52
-void cache_multi_readlock(struct mapent *me);
96dc52
-void cache_multi_writelock(struct mapent *me);
96dc52
-void cache_multi_unlock(struct mapent *me);
96dc52
 int cache_delete_offset_list(struct mapent_cache *mc, const char *key);
96dc52
 void cache_release(struct map_source *map);
96dc52
 void cache_clean_null_cache(struct mapent_cache *mc);
96dc52
diff --git a/lib/cache.c b/lib/cache.c
96dc52
index ce9e9bd2..03d0499a 100644
96dc52
--- a/lib/cache.c
96dc52
+++ b/lib/cache.c
96dc52
@@ -108,58 +108,6 @@ void cache_lock_cleanup(void *arg)
96dc52
 	return;
96dc52
 }
96dc52
 
96dc52
-void cache_multi_readlock(struct mapent *me)
96dc52
-{
96dc52
-	int status;
96dc52
-
96dc52
-	if (!me)
96dc52
-		return;
96dc52
-
96dc52
-	status = pthread_rwlock_rdlock(&me->multi_rwlock);
96dc52
-	if (status) {
96dc52
-		logmsg("mapent cache multi mutex lock failed");
96dc52
-		fatal(status);
96dc52
-	}
96dc52
-	return;
96dc52
-}
96dc52
-
96dc52
-void cache_multi_writelock(struct mapent *me)
96dc52
-{
96dc52
-	int status;
96dc52
-
96dc52
-	if (!me)
96dc52
-		return;
96dc52
-
96dc52
-	status = pthread_rwlock_wrlock(&me->multi_rwlock);
96dc52
-	if (status) {
96dc52
-		logmsg("mapent cache multi mutex lock failed");
96dc52
-		fatal(status);
96dc52
-	}
96dc52
-	return;
96dc52
-}
96dc52
-
96dc52
-void cache_multi_unlock(struct mapent *me)
96dc52
-{
96dc52
-	int status;
96dc52
-
96dc52
-	if (!me)
96dc52
-		return;
96dc52
-
96dc52
-	status = pthread_rwlock_unlock(&me->multi_rwlock);
96dc52
-	if (status) {
96dc52
-		logmsg("mapent cache multi mutex unlock failed");
96dc52
-		fatal(status);
96dc52
-	}
96dc52
-	return;
96dc52
-}
96dc52
-
96dc52
-void cache_multi_lock_cleanup(void *arg)
96dc52
-{
96dc52
-	struct mapent *me = (struct mapent *) arg;
96dc52
-	cache_multi_unlock(me);
96dc52
-	return;
96dc52
-}
96dc52
-
96dc52
 static inline void ino_index_lock(struct mapent_cache *mc)
96dc52
 {
96dc52
 	int status = pthread_mutex_lock(&mc->ino_index_mutex);
96dc52
@@ -626,7 +574,6 @@ int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, c
96dc52
 	struct mapent *me, *existing = NULL;
96dc52
 	char *pkey, *pent;
96dc52
 	u_int32_t hashval = hash(key, mc->size);
96dc52
-	int status;
96dc52
 
96dc52
 	me = (struct mapent *) malloc(sizeof(struct mapent));
96dc52
 	if (!me)
96dc52
@@ -665,10 +612,6 @@ int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, c
96dc52
 	me->ino = (ino_t) -1;
96dc52
 	me->flags = 0;
96dc52
 
96dc52
-	status = pthread_rwlock_init(&me->multi_rwlock, NULL);
96dc52
-	if (status)
96dc52
-		fatal(status);
96dc52
-
96dc52
 	/* 
96dc52
 	 * We need to add to the end if values exist in order to
96dc52
 	 * preserve the order in which the map was read on lookup.
96dc52
@@ -924,7 +867,7 @@ int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key
96dc52
 	return ret;
96dc52
 }
96dc52
 
96dc52
-/* cache_multi_lock of the multi mount owner must be held by caller */
96dc52
+/* cache write lock of the multi mount owner must be held by caller */
96dc52
 int cache_delete_offset(struct mapent_cache *mc, const char *key)
96dc52
 {
96dc52
 	u_int32_t hashval = hash(key, mc->size);
96dc52
@@ -956,9 +899,6 @@ int cache_delete_offset(struct mapent_cache *mc, const char *key)
96dc52
 	return CHE_FAIL;
96dc52
 
96dc52
 delete:
96dc52
-	status = pthread_rwlock_destroy(&me->multi_rwlock);
96dc52
-	if (status)
96dc52
-		fatal(status);
96dc52
 	list_del(&me->multi_list);
96dc52
 	ino_index_lock(mc);
96dc52
 	list_del(&me->ino_index);
96dc52
@@ -976,7 +916,7 @@ int cache_delete(struct mapent_cache *mc, const char *key)
96dc52
 {
96dc52
 	struct mapent *me = NULL, *pred;
96dc52
 	u_int32_t hashval = hash(key, mc->size);
96dc52
-	int status, ret = CHE_OK;
96dc52
+	int ret = CHE_OK;
96dc52
 	char this[PATH_MAX];
96dc52
 
96dc52
 	strcpy(this, key);
96dc52
@@ -997,9 +937,6 @@ int cache_delete(struct mapent_cache *mc, const char *key)
96dc52
 				goto done;
96dc52
 			}
96dc52
 			pred->next = me->next;
96dc52
-			status = pthread_rwlock_destroy(&me->multi_rwlock);
96dc52
-			if (status)
96dc52
-				fatal(status);
96dc52
 			ino_index_lock(mc);
96dc52
 			list_del(&me->ino_index);
96dc52
 			ino_index_unlock(mc);
96dc52
@@ -1029,9 +966,6 @@ int cache_delete(struct mapent_cache *mc, const char *key)
96dc52
 			goto done;
96dc52
 		}
96dc52
 		mc->hash[hashval] = me->next;
96dc52
-		status = pthread_rwlock_destroy(&me->multi_rwlock);
96dc52
-		if (status)
96dc52
-			fatal(status);
96dc52
 		ino_index_lock(mc);
96dc52
 		list_del(&me->ino_index);
96dc52
 		ino_index_unlock(mc);