2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 CTERA Networks. All Rights Reserved.
7 # Test concurrent copy up
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
28 # remove previous $seqres.full before test
31 # real QA test starts here
35 # Remove all files from previous tests
38 # overlay copy_up doesn't deal with sparse file well, holes will be filled by
39 # zeros, so for the worst case of hitting all the copy up bomb files, we need
40 # (64*(16+32+64+128)M) free space on $OVL_BASE_SCRATCH_MNT.
41 # However, triggering more than a total of 16 copy up bombs would require
42 # really fast data copy (clone up doesn't take up space at all), so let's be
43 # conservative and reserve space for 16 data copy ups per directory.
44 _require_fs_space $OVL_BASE_SCRATCH_MNT $((16*(16+32+64+128)*1024))
46 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
50 d_low=$lowerdir/$testdir
53 # Create 4K empty files in 4 directories
54 echo $FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full
55 $FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full 2>&1
56 echo "--------------------------------------" >> $seqres.full
57 echo "Created 1K files in lower directory. " >> $seqres.full
59 # Plant 64 copy up bombs in each directory
60 for f in $d_low/p0/*0; do $XFS_IO_PROG -c "truncate 128m" $f ;done
61 for f in $d_low/p1/*4; do $XFS_IO_PROG -c "truncate 64m" $f ;done
62 for f in $d_low/p2/*8; do $XFS_IO_PROG -c "truncate 32m" $f ;done
63 for f in $d_low/p3/*b; do $XFS_IO_PROG -c "truncate 16m" $f ;done
64 echo "Created 64*4 copy up bombs. " >> $seqres.full
65 echo "--------------------------------------" >> $seqres.full
69 d_top=$SCRATCH_MNT/$testdir
72 # Run 2 process teams - 4 pairs of rival processes
73 # Each process pair competing on copy up of 1K files in 1 directory.
74 # Team 'touch' players touch all files in readdir order.
75 # Team 'truncate' players truncates all files in numeric (name) order.
77 # If player from team 'touch' reaches a copy up bomb before player
78 # from team 'truncate' does, the copy up of (sparse) data will delay
79 # the end of the process pair match.
81 # If copy up of bomb is not concurrent with other copy ups, then
82 # 'touch' player p0 with the largest copy up bombs will delay players
83 # of both teams and all matches will take longer.
85 # If copy up is concurrent with copy ups in different directories,
86 # process pair 3 match will be over first and process pair 0 match
89 # If copy up of data is concurrent with other copy ups on the same directory,
90 # then all the 'touch' team players will finish far behind their 'truncate'
93 # This test doesn't verify any of those conditions, it will only fail
94 # on unexpected errors of any of the touch/truncate operations.
95 # The test full output should demonstrate the expected game results,
96 # as described above and depending on concurrent copy up support in kernel.
99 echo "--------------------------------------" >> $seqres.full
100 echo "Go team touch!! " >> $seqres.full
101 find p0 -type f -print -exec touch {} \; >> $seqres.full &
102 find p1 -type f -print -exec touch {} \; >> $seqres.full &
103 find p2 -type f -print -exec touch {} \; >> $seqres.full &
104 find p3 -type f -print -exec touch {} \; >> $seqres.full &
107 echo "--------------------------------------" >> $seqres.full
108 echo "Go team truncate!! " >> $seqres.full
109 # Give team 'touch' a 1 second head start.
110 # Team 'truncate' players should catch up after few copy up bombs.
112 $FSSTRESS_PROG -d $d_top -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full &
116 echo "Silence is golden"