From 734e6a7e389ea309d5528133ed5bd19064799f13 Mon Sep 17 00:00:00 2001 From: Xavi Hernandez Date: Thu, 4 Apr 2019 22:28:51 +0200 Subject: tests: correctly check open fd's when gfid is missing The helper funcion get_fd_count() returns how many open fd's has a given gfid on a brick. It could happen that the brick doesn't have information about that inode because it has not been previously accessed. Before this patch, the function returned "" when the inode was not present. This caused basic/ec/ec-fix-openfd.t test to fail because it was expecting '0' as the result. This patch forces get_fd_count() to return '0' when the gfid is not present in the state dump. Change-Id: I848b57744e96656bf81fbb7b126a5faf44e535eb updates: bz#1193929 Signed-off-by: Xavi Hernandez --- tests/volume.rc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/volume.rc b/tests/volume.rc index 620268ccfb9..e4f47d92565 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -839,6 +839,9 @@ function get_fd_count { else count=$(grep "${brick}.active.1" -A3 $statedump | grep "gfid=$gfid_str" -A2 | grep fd-count | cut -f2 -d'=' | tail -1) fi +# If no information is found for a given gfid, it means it has not been +# accessed, so it doesn't have any open fd. In this case we return 0. + count="${count:-0}" rm -f $statedump echo $count } -- cgit