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
50 $KILLALL_PROG -q $DUPEREMOVE_PROG > /dev/null 2>&1
54 # Make sure all fsstress get killed
55 while [ $f -ne 0 ]; do
56 $KILLALL_PROG -q $FSSTRESS_PROG > /dev/null 2>&1
58 f=`ps -eLf | grep $FSSTRESS_PROG | grep -v "grep" | wc -l`
62 sleep_time=$((50 * TIME_FACTOR))
65 testdir="$SCRATCH_MNT/dir"
67 fsstress_opts="-r -n 1000 -p $((5 * LOAD_FACTOR))"
68 $FSSTRESS_PROG $fsstress_opts -d $testdir -l 0 >> $seqres.full 2>&1 &
70 dupe_run=$TEST_DIR/${seq}-running
71 # Start several dedupe processes on same directory
73 for ((i = 0; i < $((2 * LOAD_FACTOR)); i++)); do
74 while [ -e $dupe_run ]; do
75 $DUPEREMOVE_PROG -dr --dedupe-options=same $testdir \
77 done 2>&1 | sed -e '/Terminated/d' &
78 dedup_pids="$! $dedup_pids"
81 # End the test after $sleep_time seconds
85 # umount and mount again, verify pagecache contents don't mutate and a fresh
86 # read from the disk also doesn't show mutations.
87 find $testdir -type f -exec md5sum {} \; > ${tmp}.md5sum
89 md5sum -c --quiet ${tmp}.md5sum
91 echo "Silence is golden"