summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2018-02-15 16:12:12 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2018-03-02 05:26:00 +0000
commita42137eee3c9e340ac9c82ebacca14eeb4b9d912 (patch)
tree19e2f5cbc589acc298cd0ee49d0675411b502947 /tests
parente7b79c59590c203c65f7ac8548b30d068c232d33 (diff)
features/shard: Fix shard inode refcount when it's part of priv->lru_list.
For as long as a shard's inode is in priv->lru_list, it should have a non-zero ref-count. This patch achieves it by taking a ref on the inode when it is added to lru list. When it's time for the inode to be evicted from the lru list, a corresponding unref is done. Change-Id: I289ffb41e7be5df7489c989bc1bbf53377433c86 BUG: 1468483 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/inode-leak.t17
-rw-r--r--tests/bugs/shard/shard-inode-refcount-test.t27
-rw-r--r--tests/volume.rc18
3 files changed, 45 insertions, 17 deletions
diff --git a/tests/basic/inode-leak.t b/tests/basic/inode-leak.t
index f73d2af6898..6bfbf572f03 100644
--- a/tests/basic/inode-leak.t
+++ b/tests/basic/inode-leak.t
@@ -3,23 +3,6 @@
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
-function get_mount_active_size_value {
- local vol=$1
- local statedump=$(generate_mount_statedump $vol)
- sleep 1
- local val=$(grep "active_size" $statedump | cut -f2 -d'=' | tail -1)
- rm -f $statedump
- echo $val
-}
-
-function get_mount_lru_size_value {
- local vol=$1
- local statedump=$(generate_mount_statedump $vol)
- sleep 1
- local val=$(grep "lru_size" $statedump | cut -f2 -d'=' | tail -1)
- rm -f $statedump
- echo $val
-}
cleanup
TEST glusterd
diff --git a/tests/bugs/shard/shard-inode-refcount-test.t b/tests/bugs/shard/shard-inode-refcount-test.t
new file mode 100644
index 00000000000..635809724cf
--- /dev/null
+++ b/tests/bugs/shard/shard-inode-refcount-test.t
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 $H0:$B0/${V0}0
+TEST $CLI volume set $V0 features.shard on
+TEST $CLI volume set $V0 features.shard-block-size 4MB
+TEST $CLI volume start $V0
+
+TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0
+
+TEST dd if=/dev/zero of=$M0/one-plus-five-shards bs=1M count=23
+
+ACTIVE_INODES_BEFORE=$(get_mount_active_size_value $V0)
+TEST rm -f $M0/one-plus-five-shards
+EXPECT `expr $ACTIVE_INODES_BEFORE - 5` get_mount_active_size_value $V0
+
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
+TEST $CLI volume stop $V0
+TEST $CLI volume delete $V0
+
+cleanup
diff --git a/tests/volume.rc b/tests/volume.rc
index 3ee83624058..add812d4779 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -812,3 +812,21 @@ function get_fd_count {
rm -f $statedump
echo $count
}
+
+function get_mount_active_size_value {
+ local vol=$1
+ local statedump=$(generate_mount_statedump $vol)
+ sleep 1
+ local val=$(grep "active_size" $statedump | cut -f2 -d'=' | tail -1)
+ rm -f $statedump
+ echo $val
+}
+
+function get_mount_lru_size_value {
+ local vol=$1
+ local statedump=$(generate_mount_statedump $vol)
+ sleep 1
+ local val=$(grep "lru_size" $statedump | cut -f2 -d'=' | tail -1)
+ rm -f $statedump
+ echo $val
+}