summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/lock-table.c7
-rw-r--r--tests/bugs/bug-821056.t3
2 files changed, 9 insertions, 1 deletions
diff --git a/libglusterfs/src/lock-table.c b/libglusterfs/src/lock-table.c
index a2fff2e3333..42b7ed8a785 100644
--- a/libglusterfs/src/lock-table.c
+++ b/libglusterfs/src/lock-table.c
@@ -97,7 +97,12 @@ gf_del_locker (struct _lock_table *table, const char *volume,
strcmp (locker->volume, volume))
continue;
- if (locker->fd && fd && (locker->fd == fd))
+ /*
+ * It is possible for inodelk lock to come on anon-fd
+ * and inodelk unlock to come on normal fd in case of
+ * client re-opens. So don't check for fds to be equal.
+ */
+ if (locker->fd && fd)
list_move_tail (&locker->lockers, &del);
else if (locker->loc.inode && loc &&
(locker->loc.inode == loc->inode))
diff --git a/tests/bugs/bug-821056.t b/tests/bugs/bug-821056.t
index 0c937cee5da..5e81541ac3a 100644
--- a/tests/bugs/bug-821056.t
+++ b/tests/bugs/bug-821056.t
@@ -8,6 +8,7 @@ TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
+TEST $CLI volume set $V0 eager-lock off
TEST $CLI volume set $V0 cluster.self-heal-daemon off
TEST $CLI volume set $V0 performance.quick-read off
TEST $CLI volume set $V0 performance.open-behind off
@@ -46,4 +47,6 @@ EXPECT_WITHIN 20 "Y" gf_check_file_opened_in_brick $V0 $H0 $B0/${V0}0 $B0/${V0}0
#close the fd
exec 5>&-
+#Check that anon-fd based file is not leaking.
+EXPECT_WITHIN 20 "N" gf_check_file_opened_in_brick $V0 $H0 $B0/${V0}0 "$realpath"
cleanup;