summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/event-epoll.c4
-rw-r--r--libglusterfs/src/fd.c10
-rw-r--r--libglusterfs/src/gidcache.c4
-rw-r--r--libglusterfs/src/rbthash.c5
4 files changed, 12 insertions, 11 deletions
diff --git a/libglusterfs/src/event-epoll.c b/libglusterfs/src/event-epoll.c
index dcaf9804529..be8b204b7a7 100644
--- a/libglusterfs/src/event-epoll.c
+++ b/libglusterfs/src/event-epoll.c
@@ -1018,7 +1018,7 @@ event_handled_epoll(struct event_pool *event_pool, int fd, int idx, int gen)
" from gen=%d to slot->gen=%d, fd=%d, "
"slot->fd=%d",
idx, gen, slot->gen, fd, slot->fd);
- goto post_unlock;
+ goto unlock;
}
/* This call also picks up the changes made by another
@@ -1033,7 +1033,7 @@ event_handled_epoll(struct event_pool *event_pool, int fd, int idx, int gen)
ret = epoll_ctl(event_pool->fd, EPOLL_CTL_MOD, fd, &epoll_event);
}
}
-post_unlock:
+unlock:
UNLOCK(&slot->lock);
event_slot_unref(event_pool, slot, idx);
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 44a9ee69d67..b8aac726093 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -766,13 +766,13 @@ fd_anonymous_with_flags(inode_t *inode, int32_t flags)
{
fd_t *fd = NULL;
+ if (flags & O_DIRECT)
+ flags = GF_ANON_FD_FLAGS | O_DIRECT;
+ else
+ flags = GF_ANON_FD_FLAGS;
+
LOCK(&inode->lock);
{
- if (flags & O_DIRECT)
- flags = GF_ANON_FD_FLAGS | O_DIRECT;
- else
- flags = GF_ANON_FD_FLAGS;
-
fd = __fd_anonymous(inode, flags);
}
UNLOCK(&inode->lock);
diff --git a/libglusterfs/src/gidcache.c b/libglusterfs/src/gidcache.c
index 87147163e9e..40fcffbb35e 100644
--- a/libglusterfs/src/gidcache.c
+++ b/libglusterfs/src/gidcache.c
@@ -64,8 +64,8 @@ gid_cache_lookup(gid_cache_t *cache, uint64_t id, uint64_t uid, uint64_t gid)
time_t now;
const gid_list_t *agl;
- LOCK(&cache->gc_lock);
now = time(NULL);
+ LOCK(&cache->gc_lock);
bucket = id % cache->gc_nbuckets;
agl = BUCKET_START(cache->gc_cache, bucket);
for (i = 0; i < AUX_GID_CACHE_ASSOC; i++, agl++) {
@@ -132,8 +132,8 @@ gid_cache_add(gid_cache_t *cache, gid_list_t *gl)
if (!cache->gc_max_age)
return 0;
- LOCK(&cache->gc_lock);
now = time(NULL);
+ LOCK(&cache->gc_lock);
/*
* Scan for the first free entry or one that matches this id. The id
diff --git a/libglusterfs/src/rbthash.c b/libglusterfs/src/rbthash.c
index 1bdd45f9fae..ae2e158d61e 100644
--- a/libglusterfs/src/rbthash.c
+++ b/libglusterfs/src/rbthash.c
@@ -252,10 +252,11 @@ rbthash_insert_entry(rbthash_table_t *tbl, rbthash_entry_t *entry)
LOCK(&bucket->bucketlock);
{
if (!rb_probe(bucket->bucket, (void *)entry)) {
+ UNLOCK(&bucket->bucketlock);
gf_msg(GF_RBTHASH, GF_LOG_ERROR, 0, LG_MSG_RBTHASH_INSERT_FAILED,
- "Failed to insert"
- " entry");
+ "Failed to insert entry");
ret = -1;
+ goto err;
}
}
UNLOCK(&bucket->bucketlock);