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
36 # Remove all files from previous tests
39 # overlay copy_up doesn't deal with sparse file well, holes will be filled by
40 # zeros, so for the worst case of hitting all the copy up bomb files, we need
41 # (64*(16+32+64+128)M) free space on $OVL_BASE_SCRATCH_MNT.
42 # However, triggering more than a total of 16 copy up bombs would require
43 # really fast data copy (clone up doesn't take up space at all), so let's be
44 # conservative and reserve space for 16 data copy ups per directory.
45 _require_fs_space $OVL_BASE_SCRATCH_MNT $((16*(16+32+64+128)*1024))
47 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
51 d_low=$lowerdir/$testdir
54 # Create 4K empty files in 4 directories
55 echo $FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full
56 $FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full 2>&1
57 echo "--------------------------------------" >> $seqres.full
58 echo "Created 1K files in lower directory. " >> $seqres.full
60 # Plant 64 copy up bombs in each directory
61 for f in $d_low/p0/*0; do $XFS_IO_PROG -c "truncate 128m" $f ;done
62 for f in $d_low/p1/*4; do $XFS_IO_PROG -c "truncate 64m" $f ;done
63 for f in $d_low/p2/*8; do $XFS_IO_PROG -c "truncate 32m" $f ;done
64 for f in $d_low/p3/*b; do $XFS_IO_PROG -c "truncate 16m" $f ;done
65 echo "Created 64*4 copy up bombs. " >> $seqres.full
66 echo "--------------------------------------" >> $seqres.full
70 d_top=$SCRATCH_MNT/$testdir
73 # Run 2 process teams - 4 pairs of rival processes
74 # Each process pair competing on copy up of 1K files in 1 directory.
75 # Team 'touch' players touch all files in readdir order.
76 # Team 'truncate' players truncates all files in numeric (name) order.
78 # If player from team 'touch' reaches a copy up bomb before player
79 # from team 'truncate' does, the copy up of (sparse) data will delay
80 # the end of the process pair match.
82 # If copy up of bomb is not concurrent with other copy ups, then
83 # 'touch' player p0 with the largest copy up bombs will delay players
84 # of both teams and all matches will take longer.
86 # If copy up is concurrent with copy ups in different directories,
87 # process pair 3 match will be over first and process pair 0 match
90 # If copy up of data is concurrent with other copy ups on the same directory,
91 # then all the 'touch' team players will finish far behind their 'truncate'
94 # This test doesn't verify any of those conditions, it will only fail
95 # on unexpected errors of any of the touch/truncate operations.
96 # The test full output should demonstrate the expected game results,
97 # as described above and depending on concurrent copy up support in kernel.
100 echo "--------------------------------------" >> $seqres.full
101 echo "Go team touch!! " >> $seqres.full
102 find p0 -type f -print -exec touch {} \; >> $seqres.full &
103 find p1 -type f -print -exec touch {} \; >> $seqres.full &
104 find p2 -type f -print -exec touch {} \; >> $seqres.full &
105 find p3 -type f -print -exec touch {} \; >> $seqres.full &
108 echo "--------------------------------------" >> $seqres.full
109 echo "Go team truncate!! " >> $seqres.full
110 # Give team 'touch' a 1 second head start.
111 # Team 'truncate' players should catch up after few copy up bombs.
113 $FSSTRESS_PROG -d $d_top -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full &
117 echo "Silence is golden"