common: kill _supported_os
[xfstests-dev.git] / tests / xfs / 440
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 440
6 #
7 # Regression test for a quota accounting bug when changing the owner of
8 # a file that has CoW reservations and no dirty pages.  The reservations
9 # should shift over to the new owner, but they do not.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/reflink
29 . ./common/quota
30 . ./common/filter
31
32 # Modify as appropriate.
33 _supported_fs xfs
34
35 _require_quota
36 _require_scratch_reflink
37 _require_cp_reflink
38 _require_user
39
40 rm -f $seqres.full
41
42 echo "Format and mount"
43 _scratch_mkfs > "$seqres.full" 2>&1
44 _scratch_mount "-o usrquota,grpquota" >> "$seqres.full" 2>&1
45
46 echo "Create files"
47 $XFS_IO_PROG -c "cowextsize 1m" $SCRATCH_MNT
48 touch $SCRATCH_MNT/a $SCRATCH_MNT/force_fsgqa
49 chown $qa_user $SCRATCH_MNT/a $SCRATCH_MNT/force_fsgqa
50 _pwrite_byte 0x58 0 64k $SCRATCH_MNT/a >> $seqres.full
51 $XFS_IO_PROG -c 'stat -r' $SCRATCH_MNT/a | grep stat.size >> $seqres.full
52 _report_quota_blocks "-u $SCRATCH_MNT"
53
54 echo "Reflink and CoW"
55 _cp_reflink $SCRATCH_MNT/a $SCRATCH_MNT/b
56 _pwrite_byte 0x59 0 64k $SCRATCH_MNT/a >> $seqres.full
57 $XFS_IO_PROG -c 'stat -r' $SCRATCH_MNT/a | grep stat.size >> $seqres.full
58 _report_quota_blocks "-u $SCRATCH_MNT"
59
60 echo "Sync"
61 sync
62 _report_quota_blocks "-u $SCRATCH_MNT"
63
64 echo "Chown and check quota"
65 chown root $SCRATCH_MNT/a
66 $XFS_IO_PROG -c 'stat -r' $SCRATCH_MNT/a | grep stat.size >> $seqres.full
67 _report_quota_blocks "-u $SCRATCH_MNT"
68
69 echo "Remount"
70 _scratch_unmount
71 _scratch_mount "-o usrquota,grpquota" >> "$seqres.full" 2>&1
72 $XFS_IO_PROG -c 'stat -r' $SCRATCH_MNT/a | grep stat.size >> $seqres.full
73 _report_quota_blocks "-u $SCRATCH_MNT"
74
75 # success, all done
76 status=0
77 exit