diff options
author | Xavi Hernandez <xhernandez@redhat.com> | 2019-04-04 22:28:51 +0200 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-04-10 11:14:26 +0000 |
commit | 734e6a7e389ea309d5528133ed5bd19064799f13 (patch) | |
tree | 8655d0027fe3082e6c6313205ed675d68170760e | |
parent | dc06e4c408187afcc58ebd72386490ad1e58de03 (diff) |
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 <xhernandez@redhat.com>
-rw-r--r-- | tests/volume.rc | 3 |
1 files changed, 3 insertions, 0 deletions
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 } |