From a42137eee3c9e340ac9c82ebacca14eeb4b9d912 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Thu, 15 Feb 2018 16:12:12 +0530 Subject: 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 --- tests/bugs/shard/shard-inode-refcount-test.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/bugs/shard/shard-inode-refcount-test.t (limited to 'tests/bugs/shard/shard-inode-refcount-test.t') 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 -- cgit