common: kill _supported_os
[xfstests-dev.git] / tests / xfs / 327
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 327
6 #
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
10 # the reflink flag.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1    # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         _scratch_unmount > /dev/null 2>&1
25         rm -rf $tmp.*
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31 . ./common/reflink
32
33 # real QA test starts here
34 _supported_fs xfs
35 _require_cp_reflink
36 _require_scratch_reflink
37
38 rm -f $seqres.full
39
40 nr=128 # spanning at least one inode chunk tickles a bug in xfs_repair
41 echo "Format filesystem"
42 _scratch_mkfs >/dev/null 2>&1
43 _scratch_mount >> $seqres.full
44
45 echo "Create files"
46 _pwrite_byte 0x66 0 1 $SCRATCH_MNT/file.0 >> $seqres.full
47 seq 1 $nr | while read i; do
48         _cp_reflink $SCRATCH_MNT/file.0 $SCRATCH_MNT/file.$i
49 done
50 sync
51
52 echo "Check files"
53 for i in 0 $((nr / 2)) $nr; do
54         md5sum $SCRATCH_MNT/file.$i | _filter_scratch
55         $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i | _filter_scratch
56 done
57
58 echo "CoW all files"
59 seq 1 $nr | while read i; do
60         echo m >> $SCRATCH_MNT/file.$i
61 done
62
63 echo "Repair filesystem"
64 _scratch_unmount
65 _repair_scratch_fs >> $seqres.full
66 _scratch_mount
67
68 echo "Check files again"
69 for i in 0 $((nr / 2)) $nr; do
70         md5sum $SCRATCH_MNT/file.$i | _filter_scratch
71         $XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/file.$i | _filter_scratch
72 done
73
74 echo "Done"
75
76 # success, all done
77 status=0
78 exit