From 6f680d9eef683b83b478ff2aaf281d15f7c78fa2 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Wed, 9 Nov 2016 23:15:16 -0500 Subject: [PATCH] LU-6374 tests: wait for zfs commit wait_delete_completed_mds() should always wait for zfs commit to free used space. Signed-off-by: Niu Yawei Change-Id: If57e67841060d9f13ec3ba13e44f7b88a82301c5 Reviewed-on: https://review.whamcloud.com/23688 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 01779ba..dbbba93 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -2165,6 +2165,15 @@ sync_all_data() { grep -v 'Found no match' } +wait_zfs_commit() { + # the occupied disk space will be released + # only after DMUs are committed + if [[ $(facet_fstype $1) == zfs ]]; then + echo "sleep $2 for ZFS OSD" + sleep $2 + fi +} + wait_delete_completed_mds() { local MAX_WAIT=${1:-20} # for ZFS, waiting more time for DMUs to be committed @@ -2185,6 +2194,7 @@ wait_delete_completed_mds() { mds2sync="$mds2sync $node" done if [ -z "$mds2sync" ]; then + wait_zfs_commit $SINGLEMDS $ZFS_WAIT return fi mds2sync=$(comma_list $mds2sync) @@ -2202,16 +2212,7 @@ wait_delete_completed_mds() { "$LCTL get_param -n osc.*MDT*.sync_*" | calc_sum) #echo "$node: $changes changes on all" if [[ $changes -eq 0 ]]; then - etime=$(date +%s) - #echo "delete took $((etime - stime)) seconds" - - # the occupied disk space will be released - # only after DMUs are committed - if [[ $(facet_fstype $SINGLEMDS) == zfs ]]; then - echo "sleep $ZFS_WAIT for ZFS OSD" - sleep $ZFS_WAIT - fi - + wait_zfs_commit $SINGLEMDS $ZFS_WAIT return fi sleep 1 -- 1.8.3.1