74096c
From c38b38249fdf951565f6501ce8e9a4d01142d43e Mon Sep 17 00:00:00 2001
74096c
From: l17zhou <cynthia.zhou@nokia-sbell.com>
74096c
Date: Tue, 3 Dec 2019 07:43:35 +0200
74096c
Subject: [PATCH 456/456] add clean local after grant lock
74096c
74096c
found by flock test, without correct ref number of fd,
74096c
lock will not be correctly released.
74096c
74096c
Upstream patch:
74096c
> Upstream patch link: https://review.gluster.org/c/glusterfs/+/23794
74096c
> Fixes: bz#1779089
74096c
> Change-Id: I3e466b17c852eb219c8778e43af8ad670a8449cc
74096c
> Signed-off-by: l17zhou <cynthia.zhou@nokia-sbell.com>
74096c
74096c
BUG: 1854165
74096c
Change-Id: I3e466b17c852eb219c8778e43af8ad670a8449cc
74096c
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
74096c
Reviewed-on: https://code.engineering.redhat.com/gerrit/206673
74096c
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74096c
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74096c
---
74096c
 xlators/features/locks/src/common.c | 15 ++++++++-------
74096c
 1 file changed, 8 insertions(+), 7 deletions(-)
74096c
74096c
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
74096c
index 0c52853..cddbfa6 100644
74096c
--- a/xlators/features/locks/src/common.c
74096c
+++ b/xlators/features/locks/src/common.c
74096c
@@ -961,7 +961,7 @@ grant_blocked_locks(xlator_t *this, pl_inode_t *pl_inode)
74096c
     struct list_head granted_list;
74096c
     posix_lock_t *tmp = NULL;
74096c
     posix_lock_t *lock = NULL;
74096c
-
74096c
+    pl_local_t *local = NULL;
74096c
     INIT_LIST_HEAD(&granted_list);
74096c
 
74096c
     pthread_mutex_lock(&pl_inode->mutex);
74096c
@@ -976,9 +976,9 @@ grant_blocked_locks(xlator_t *this, pl_inode_t *pl_inode)
74096c
 
74096c
         pl_trace_out(this, lock->frame, NULL, NULL, F_SETLKW, &lock->user_flock,
74096c
                      0, 0, NULL);
74096c
-
74096c
-        STACK_UNWIND_STRICT(lk, lock->frame, 0, 0, &lock->user_flock, NULL);
74096c
-
74096c
+        local = lock->frame->local;
74096c
+        PL_STACK_UNWIND_AND_FREE(local, lk, lock->frame, 0, 0,
74096c
+                                 &lock->user_flock, NULL);
74096c
         __destroy_lock(lock);
74096c
     }
74096c
 
74096c
@@ -997,6 +997,7 @@ pl_send_prelock_unlock(xlator_t *this, pl_inode_t *pl_inode,
74096c
     struct list_head granted_list;
74096c
     posix_lock_t *tmp = NULL;
74096c
     posix_lock_t *lock = NULL;
74096c
+    pl_local_t *local = NULL;
74096c
 
74096c
     int ret = -1;
74096c
 
74096c
@@ -1024,9 +1025,9 @@ pl_send_prelock_unlock(xlator_t *this, pl_inode_t *pl_inode,
74096c
 
74096c
         pl_trace_out(this, lock->frame, NULL, NULL, F_SETLKW, &lock->user_flock,
74096c
                      0, 0, NULL);
74096c
-
74096c
-        STACK_UNWIND_STRICT(lk, lock->frame, 0, 0, &lock->user_flock, NULL);
74096c
-
74096c
+        local = lock->frame->local;
74096c
+        PL_STACK_UNWIND_AND_FREE(local, lk, lock->frame, 0, 0,
74096c
+                                 &lock->user_flock, NULL);
74096c
         __destroy_lock(lock);
74096c
     }
74096c
 
74096c
-- 
74096c
1.8.3.1
74096c