2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat Inc. All Rights Reserved.
5 # FS QA Test generic/561
7 # Dedup & random I/O race test, do multi-threads fsstress and dedupe on
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
37 _require_scratch_duperemove
38 _require_command "$KILLALL_PROG" killall
40 _scratch_mkfs > $seqres.full 2>&1
41 _scratch_mount >> $seqres.full 2>&1
47 # stop duperemove running
48 if [ -e $dupe_run ]; then
53 # Make sure all fsstress get killed
54 while [ $f -ne 0 ]; do
55 $KILLALL_PROG -q $FSSTRESS_PROG > /dev/null 2>&1
57 f=`ps -eLf | grep $FSSTRESS_PROG | grep -v "grep" | wc -l`
61 sleep_time=$((50 * TIME_FACTOR))
64 testdir="$SCRATCH_MNT/dir"
66 fsstress_opts="-r -n 1000 -p $((5 * LOAD_FACTOR))"
67 $FSSTRESS_PROG $fsstress_opts -d $testdir -l 0 >> $seqres.full 2>&1 &
69 dupe_run=$TEST_DIR/${seq}-running
70 # Start several dedupe processes on same directory
72 for ((i = 0; i < $((2 * LOAD_FACTOR)); i++)); do
73 while [ -e $dupe_run ]; do
74 $DUPEREMOVE_PROG -dr --dedupe-options=same $testdir \
77 dedup_pids="$! $dedup_pids"
80 # End the test after $sleep_time seconds
84 # umount and mount again, verify pagecache contents don't mutate and a fresh
85 # read from the disk also doesn't show mutations.
86 find $testdir -type f -exec md5sum {} \; > ${tmp}.md5sum
88 md5sum -c --quiet ${tmp}.md5sum
90 echo "Silence is golden"