summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2012-03-12 13:15:14 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-14 05:56:11 -0700
commit7bd561996d5a32071942b598739b130e020f89ee (patch)
tree98bff4db78c51cccb6a9c1483f0794b261a8ad6c /xlators/features/locks/src
parent84ef0ec98763c1ce92d0cc24d29d9953bb6bd3f1 (diff)
locks: Fixed incorrect list ptr manipulation in clearing entrylks
Avoided unwinding blocked entry lock frames inside pl_inode->mutex. Change-Id: I424c4a1762c889c1a567c588d4ca383a6c338886 BUG: 800412 Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-on: http://review.gluster.com/2878 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/features/locks/src')
-rw-r--r--xlators/features/locks/src/clear.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/xlators/features/locks/src/clear.c b/xlators/features/locks/src/clear.c
index d64a15b09e4..6c6afe008be 100644
--- a/xlators/features/locks/src/clear.c
+++ b/xlators/features/locks/src/clear.c
@@ -310,11 +310,13 @@ clrlk_clear_entrylk (xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t *dom,
{
pl_entry_lock_t *elock = NULL;
pl_entry_lock_t *tmp = NULL;
- struct list_head removed = {0};
int bcount = 0;
int gcount = 0;
int ret = -1;
+ struct list_head removed;
+ struct list_head released;
+ INIT_LIST_HEAD (&released);
if (args->kind & CLRLK_BLOCKED)
goto blkd;
@@ -326,21 +328,29 @@ blkd:
{
list_for_each_entry_safe (elock, tmp, &dom->blocked_entrylks,
blocked_locks) {
- if (args->opts &&
- strncmp (elock->basename, args->opts,
- strlen (elock->basename)))
- continue;
+ if (args->opts) {
+ if (!elock->basename ||
+ strcmp (elock->basename, args->opts))
+ continue;
+ }
bcount++;
- list_del_init (&elock->domain_list);
- STACK_UNWIND_STRICT (entrylk, elock->frame, -1,
- EAGAIN);
- GF_FREE ((char *) elock->basename);
- GF_FREE (elock);
+ list_del_init (&elock->blocked_locks);
+ list_add_tail (&elock->blocked_locks, &released);
}
}
pthread_mutex_unlock (&pl_inode->mutex);
+ list_for_each_entry_safe (elock, tmp, &released, blocked_locks) {
+ list_del_init (&elock->blocked_locks);
+ entrylk_trace_out (this, elock->frame, elock->volume, NULL, NULL,
+ elock->basename, ENTRYLK_LOCK, elock->type,
+ -1, EAGAIN);
+ STACK_UNWIND_STRICT (entrylk, elock->frame, -1, EAGAIN);
+ GF_FREE ((char *) elock->basename);
+ GF_FREE (elock);
+ }
+
if (!(args->kind & CLRLK_GRANTED)) {
ret = 0;
goto out;
@@ -352,13 +362,11 @@ granted:
{
list_for_each_entry_safe (elock, tmp, &dom->entrylk_list,
domain_list) {
- if (!elock->basename)
- continue;
-
- if (args->opts &&
- strncmp (elock->basename, args->opts,
- strlen (elock->basename)))
- continue;
+ if (args->opts) {
+ if (!elock->basename ||
+ strcmp (elock->basename, args->opts))
+ continue;
+ }
gcount++;
list_del_init (&elock->domain_list);