4 # Create 100 reflinked files, CoW them all, and see if xfs_repair will
5 # clear the reflink flag. There was a buffer handling bug in xfs_repair
6 # that (fortunately) triggered asserts in the rmap code when clearing
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
38 _scratch_unmount > /dev/null 2>&1
42 # get standard environment, filters and checks
47 # real QA test starts here
51 _require_scratch_reflink
55 nr=128 # spanning at least one inode chunk tickles a bug in xfs_repair
56 echo "Format filesystem"
57 _scratch_mkfs >/dev/null 2>&1
58 _scratch_mount >> $seqres.full
61 _pwrite_byte 0x66 0 1 $SCRATCH_MNT/file.0 >> $seqres.full
62 seq 1 $nr | while read i; do
63 _cp_reflink $SCRATCH_MNT/file.0 $SCRATCH_MNT/file.$i
68 for i in 0 $((nr / 2)) $nr; do
69 md5sum $SCRATCH_MNT/file.$i | _filter_scratch
70 $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i | _filter_scratch
74 seq 1 $nr | while read i; do
75 echo m >> $SCRATCH_MNT/file.$i
78 echo "Repair filesystem"
80 _repair_scratch_fs >> $seqres.full
83 echo "Check files again"
84 for i in 0 $((nr / 2)) $nr; do
85 md5sum $SCRATCH_MNT/file.$i | _filter_scratch
86 $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i | _filter_scratch