Whamcloud - gitweb
LU-7656 tests: tar fix for replay-single/70c 32/18732/3
authorNoopur Maheshwari <noopur.maheshwari@seagate.com>
Tue, 1 Mar 2016 08:25:13 +0000 (13:55 +0530)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 11 May 2016 16:37:02 +0000 (16:37 +0000)
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 <noopur.maheshwari@seagate.com>
Change-Id: Ia1c840dde554a2f1487aa9aebb70e5dcea29b806
Reviewed-on: http://review.whamcloud.com/18732
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Ujjwal Lanjewar <ujjwal@yahoo.com>
Reviewed-by: Wei Liu <wei3.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/replay-single.sh

index 5b00f7e..cd7ecb7 100755 (executable)
@@ -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
 }