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

9a499a
autofs-5.1.7 - remove unused mount offset list lock functions
9a499a
9a499a
From: Ian Kent <raven@themaw.net>
9a499a
9a499a
When fixing the locking in parse_mount() it was evident that there was
9a499a
no real benefit of having an additional lock for the offset list so its
9a499a
use was eliminated.
9a499a
9a499a
Signed-off-by: Ian Kent <raven@themaw.net>
9a499a
---
9a499a
 CHANGELOG           |    1 
9a499a
 include/automount.h |    4 --
9a499a
 lib/cache.c         |   70 +---------------------------------------------------
9a499a
 3 files changed, 3 insertions(+), 72 deletions(-)
9a499a
9a499a
--- autofs-5.1.4.orig/CHANGELOG
9a499a
+++ autofs-5.1.4/CHANGELOG
9a499a
@@ -18,6 +18,7 @@
9a499a
 - fix return from umount_subtree_mounts() on offset list delete.
9a499a
 - pass mapent_cache to update_offset_entry().
9a499a
 - fix inconsistent locking in parse_mount().
9a499a
+- remove unused mount offset list lock functions.
9a499a
 
9a499a
 xx/xx/2018 autofs-5.1.5
9a499a
 - fix flag file permission.
9a499a
--- autofs-5.1.4.orig/include/automount.h
9a499a
+++ autofs-5.1.4/include/automount.h
9a499a
@@ -162,7 +162,6 @@ struct stack {
9a499a
 struct mapent {
9a499a
 	struct mapent *next;
9a499a
 	struct list_head ino_index;
9a499a
-	pthread_rwlock_t multi_rwlock;
9a499a
 	struct list_head multi_list;
9a499a
 	struct mapent_cache *mc;
9a499a
 	struct map_source *source;
9a499a
@@ -211,9 +210,6 @@ int cache_set_offset_parent(struct mapen
9a499a
 int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age);
9a499a
 int cache_delete(struct mapent_cache *mc, const char *key);
9a499a
 int cache_delete_offset(struct mapent_cache *mc, const char *key);
9a499a
-void cache_multi_readlock(struct mapent *me);
9a499a
-void cache_multi_writelock(struct mapent *me);
9a499a
-void cache_multi_unlock(struct mapent *me);
9a499a
 int cache_delete_offset_list(struct mapent_cache *mc, const char *key);
9a499a
 void cache_release(struct map_source *map);
9a499a
 void cache_clean_null_cache(struct mapent_cache *mc);
9a499a
--- autofs-5.1.4.orig/lib/cache.c
9a499a
+++ autofs-5.1.4/lib/cache.c
9a499a
@@ -108,58 +108,6 @@ void cache_lock_cleanup(void *arg)
9a499a
 	return;
9a499a
 }
9a499a
 
9a499a
-void cache_multi_readlock(struct mapent *me)
9a499a
-{
9a499a
-	int status;
9a499a
-
9a499a
-	if (!me)
9a499a
-		return;
9a499a
-
9a499a
-	status = pthread_rwlock_rdlock(&me->multi_rwlock);
9a499a
-	if (status) {
9a499a
-		logmsg("mapent cache multi mutex lock failed");
9a499a
-		fatal(status);
9a499a
-	}
9a499a
-	return;
9a499a
-}
9a499a
-
9a499a
-void cache_multi_writelock(struct mapent *me)
9a499a
-{
9a499a
-	int status;
9a499a
-
9a499a
-	if (!me)
9a499a
-		return;
9a499a
-
9a499a
-	status = pthread_rwlock_wrlock(&me->multi_rwlock);
9a499a
-	if (status) {
9a499a
-		logmsg("mapent cache multi mutex lock failed");
9a499a
-		fatal(status);
9a499a
-	}
9a499a
-	return;
9a499a
-}
9a499a
-
9a499a
-void cache_multi_unlock(struct mapent *me)
9a499a
-{
9a499a
-	int status;
9a499a
-
9a499a
-	if (!me)
9a499a
-		return;
9a499a
-
9a499a
-	status = pthread_rwlock_unlock(&me->multi_rwlock);
9a499a
-	if (status) {
9a499a
-		logmsg("mapent cache multi mutex unlock failed");
9a499a
-		fatal(status);
9a499a
-	}
9a499a
-	return;
9a499a
-}
9a499a
-
9a499a
-void cache_multi_lock_cleanup(void *arg)
9a499a
-{
9a499a
-	struct mapent *me = (struct mapent *) arg;
9a499a
-	cache_multi_unlock(me);
9a499a
-	return;
9a499a
-}
9a499a
-
9a499a
 static inline void ino_index_lock(struct mapent_cache *mc)
9a499a
 {
9a499a
 	int status = pthread_mutex_lock(&mc->ino_index_mutex);
9a499a
@@ -626,7 +574,6 @@ int cache_add(struct mapent_cache *mc, s
9a499a
 	struct mapent *me, *existing = NULL;
9a499a
 	char *pkey, *pent;
9a499a
 	u_int32_t hashval = hash(key, mc->size);
9a499a
-	int status;
9a499a
 
9a499a
 	me = (struct mapent *) malloc(sizeof(struct mapent));
9a499a
 	if (!me)
9a499a
@@ -665,10 +612,6 @@ int cache_add(struct mapent_cache *mc, s
9a499a
 	me->ino = (ino_t) -1;
9a499a
 	me->flags = 0;
9a499a
 
9a499a
-	status = pthread_rwlock_init(&me->multi_rwlock, NULL);
9a499a
-	if (status)
9a499a
-		fatal(status);
9a499a
-
9a499a
 	/* 
9a499a
 	 * We need to add to the end if values exist in order to
9a499a
 	 * preserve the order in which the map was read on lookup.
9a499a
@@ -894,7 +837,7 @@ int cache_update(struct mapent_cache *mc
9a499a
 	return ret;
9a499a
 }
9a499a
 
9a499a
-/* cache_multi_lock of the multi mount owner must be held by caller */
9a499a
+/* cache write lock of the multi mount owner must be held by caller */
9a499a
 int cache_delete_offset(struct mapent_cache *mc, const char *key)
9a499a
 {
9a499a
 	u_int32_t hashval = hash(key, mc->size);
9a499a
@@ -926,9 +869,6 @@ int cache_delete_offset(struct mapent_ca
9a499a
 	return CHE_FAIL;
9a499a
 
9a499a
 delete:
9a499a
-	status = pthread_rwlock_destroy(&me->multi_rwlock);
9a499a
-	if (status)
9a499a
-		fatal(status);
9a499a
 	list_del(&me->multi_list);
9a499a
 	ino_index_lock(mc);
9a499a
 	list_del(&me->ino_index);
9a499a
@@ -946,7 +886,7 @@ int cache_delete(struct mapent_cache *mc
9a499a
 {
9a499a
 	struct mapent *me = NULL, *pred;
9a499a
 	u_int32_t hashval = hash(key, mc->size);
9a499a
-	int status, ret = CHE_OK;
9a499a
+	int ret = CHE_OK;
9a499a
 	char this[PATH_MAX];
9a499a
 
9a499a
 	strcpy(this, key);
9a499a
@@ -967,9 +907,6 @@ int cache_delete(struct mapent_cache *mc
9a499a
 				goto done;
9a499a
 			}
9a499a
 			pred->next = me->next;
9a499a
-			status = pthread_rwlock_destroy(&me->multi_rwlock);
9a499a
-			if (status)
9a499a
-				fatal(status);
9a499a
 			ino_index_lock(mc);
9a499a
 			list_del(&me->ino_index);
9a499a
 			ino_index_unlock(mc);
9a499a
@@ -999,9 +936,6 @@ int cache_delete(struct mapent_cache *mc
9a499a
 			goto done;
9a499a
 		}
9a499a
 		mc->hash[hashval] = me->next;
9a499a
-		status = pthread_rwlock_destroy(&me->multi_rwlock);
9a499a
-		if (status)
9a499a
-			fatal(status);
9a499a
 		ino_index_lock(mc);
9a499a
 		list_del(&me->ino_index);
9a499a
 		ino_index_unlock(mc);