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>
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
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=$!
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
}