From: Noopur Maheshwari Date: Tue, 1 Mar 2016 08:25:13 +0000 (+0530) Subject: LU-7656 tests: tar fix for replay-single/70c X-Git-Tag: 2.8.54~70 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=13f4d2a5ab81b479fcc1cd2263c2cd8db8b616c5 LU-7656 tests: tar fix for replay-single/70c The tar process runs in an infinite loop, and the removal/cleanup of files interferes in the process and causes tar to fail. The code flow could take two paths: 1. Mdt recovery has completed, catch exit signal. In this case, put a check and confirm if the mdt recovery has completed, if yes, then exit and perform cleanup commands (remove files). 2. Main process code flow. Wait for tar process to complete and then perform cleanup commands. Also, instead of removing files within the tar process, keep the removal of files in the cleanup part. Seagate-bug-id: MRP-2925 Signed-off-by: Noopur Maheshwari Change-Id: Ia1c840dde554a2f1487aa9aebb70e5dcea29b806 Reviewed-on: http://review.whamcloud.com/18732 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Ujjwal Lanjewar Reviewed-by: Wei Liu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 5b00f7e..cd7ecb7 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -2130,8 +2130,10 @@ random_fail_mdt() { cleanup_70c() { trap 0 - kill -9 $tar_70c_pid + rm -f $DIR/replay-single.70c.lck + rm -rf /$DIR/$tdir } + test_70c () { local clients=${CLIENTS:-$HOSTNAME} local rc=0 @@ -2148,16 +2150,14 @@ test_70c () { trap cleanup_70c EXIT ( - while true; do + while [ ! -e $DIR/replay-single.70c.lck ]; do test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break if [ $MDSCOUNT -ge 2 ]; then $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir || error "set default dirstripe failed" fi cd $DIR/$tdir || break - tar cf - /etc | tar xf - || error "tar failed" - cd $DIR || break - rm -rf $DIR/$tdir || break + tar cf - /etc | tar xf - || error "tar failed in loop" done )& tar_70c_pid=$! @@ -2166,6 +2166,9 @@ test_70c () { random_fail_mdt $MDSCOUNT $duration $tar_70c_pid kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped" + touch $DIR/replay-single.70c.lck + wait $tar_70c_pid || error "$?: tar failed" + cleanup_70c true }