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

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