2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Create 100 reflinked files, CoW them all, and see if xfs_repair will
8 # clear the reflink flag. There was a buffer handling bug in xfs_repair
9 # that (fortunately) triggered asserts in the rmap code when clearing
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
24 _scratch_unmount > /dev/null 2>&1
28 # get standard environment, filters and checks
33 # real QA test starts here
37 _require_scratch_reflink
41 nr=128 # spanning at least one inode chunk tickles a bug in xfs_repair
42 echo "Format filesystem"
43 _scratch_mkfs >/dev/null 2>&1
44 _scratch_mount >> $seqres.full
47 _pwrite_byte 0x66 0 1 $SCRATCH_MNT/file.0 >> $seqres.full
48 seq 1 $nr | while read i; do
49 _cp_reflink $SCRATCH_MNT/file.0 $SCRATCH_MNT/file.$i
54 for i in 0 $((nr / 2)) $nr; do
55 md5sum $SCRATCH_MNT/file.$i | _filter_scratch
56 $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i | _filter_scratch
60 seq 1 $nr | while read i; do
61 echo m >> $SCRATCH_MNT/file.$i
64 echo "Repair filesystem"
66 _repair_scratch_fs >> $seqres.full
69 echo "Check files again"
70 for i in 0 $((nr / 2)) $nr; do
71 md5sum $SCRATCH_MNT/file.$i | _filter_scratch
72 $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i | _filter_scratch