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