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

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