4 # Try to ENOSPC while expanding the refcntbt by CoWing every other block
5 # of a file that eats the whole AG.
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2015, Oracle and/or its affiliates. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
36 rm -rf $tmp.* $testdir
39 # get standard environment, filters and checks
44 # real QA test starts here
46 _require_scratch_reflink
51 echo "Format and mount"
52 _scratch_mkfs -d agsize=$((32 * 1048576)) > $seqres.full 2>&1
53 _scratch_mount >> $seqres.full 2>&1
55 testdir=$SCRATCH_MNT/test-$seq
57 blksz=$(get_block_size $testdir)
59 echo "Create the original files"
62 _pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
63 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
64 _pwrite_byte 0x61 0 $sz $testdir/file2.chk >> $seqres.full
68 cmp -s $testdir/file1 $testdir/file2 || echo "file1 and file2 do not match"
69 cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
71 echo "CoW every other block"
72 seq 1 2 $((nr - 1)) | while read f; do
73 _pwrite_byte 0x62 $((f * blksz)) $blksz $testdir/file2 >> $seqres.full
74 _pwrite_byte 0x62 $((f * blksz)) $blksz $testdir/file2.chk >> $seqres.full
79 ! cmp -s $testdir/file1 $testdir/file2 || echo "file1 and file2 must not match"
80 cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"