generic: test deadlock on O_DIRECT|O_DSYNC
[xfstests-dev.git] / tests / generic / 533
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 # Copyright (c) 2017 Google, Inc.  All Rights Reserved.
5 # Copyright (c) 2019 Red Hat Inc.  All Rights Reserved.
6 #
7 # FS QA Test No. 526.
8 #
9 # Simple attr smoke tests for user EAs, dereived from generic/097.
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 file=$TEST_DIR/foo.$seq
21
22 _cleanup()
23 {
24         cd /
25         rm -f $tmp.*
26 }
27
28 getfattr()
29 {
30         _getfattr --absolute-names "$@" |& _filter_test_dir
31 }
32
33 setfattr()
34 {
35         $SETFATTR_PROG "$@" |& _filter_test_dir
36 }
37
38 # get standard environment, filters and checks
39 . ./common/rc
40 . ./common/attr
41 . ./common/filter
42
43 # real QA test starts here
44 _supported_fs generic
45 _supported_os Linux
46
47 _require_test
48 _require_attrs
49
50 # remove previous $seqres.full before test
51 rm -f $seqres.full
52
53 echo -e "\ncreate file foo.$seq"
54 rm -f $file
55 touch $file
56
57 echo -e "\nshould be no EAs for foo.$seq:"
58 getfattr -d $file
59
60 echo -e "\nset EA <NOISE,woof>:"
61 setfattr -n user.NOISE -v woof $file
62
63 echo -e "\nset EA <COLOUR,blue>:"
64 setfattr -n user.COLOUR -v blue $file
65
66 echo -e "\nset EA <SIZE,small>:"
67 setfattr -n user.SIZE -v small $file
68
69 echo -e "\nlist the EAs for foo.$seq: NOISE, COLOUR, SIZE"
70 getfattr -d $file
71
72 echo -e "\ncheck the list again for foo.$seq"
73 getfattr -d $file
74
75 echo -e "\nunmount the FS and see if EAs are persistent"
76 _test_cycle_mount
77
78 echo -e "\ncheck the list again for foo.$seq after umount/mount"
79 getfattr -d $file
80
81 echo -e "\nremove the COLOUR EA on foo.$seq"
82 setfattr -x user.COLOUR $file
83
84 echo -e "\nlist EAs for foo.$seq: NOISE, SIZE"
85 getfattr -d $file
86
87 echo -e "\nget the value of the NOISE EA"
88 getfattr -n user.NOISE $file
89
90 echo -e "\nget the value of the COLOUR EA which was removed earlier"
91 getfattr -n user.COLOUR $file
92
93 echo -e "\nget the value of the SIZE EA"
94 getfattr -n user.SIZE $file
95
96 echo -e "\nlist all the EAs again: NOISE, SIZE"
97 getfattr -d $file
98
99 echo -e "\nchange the value of the SIZE EA from small to huge"
100 setfattr -n user.SIZE -v huge $file
101
102 echo -e "\nget the SIZE EA which should now have value huge"
103 getfattr -n user.SIZE $file
104
105 echo -e "\nlist EAs: NOISE, SIZE"
106 getfattr -d $file
107
108 echo -e "\nremove the SIZE EA from foo.$seq"
109 setfattr -x user.SIZE $file
110
111 echo -e "\nlist EAs: NOISE (SIZE EA has been removed)"
112 getfattr -d $file
113
114 echo -e "\ntry removing non-existent EA named woof"
115 setfattr -x user.WOOF $file
116
117 echo -e "\ntry removing already removed EA SIZE"
118 setfattr -x user.SIZE $file
119
120 echo -e "\nlist EAs: NOISE"
121 getfattr -d $file
122
123 echo -e "\ntry removing already removed EA COLOUR"
124 setfattr -x user.COLOUR $file
125
126 echo -e "\nlist EAs: NOISE"
127 getfattr -d $file
128
129 echo -e "\nremove remaining EA NOISE"
130 setfattr -x user.NOISE $file
131
132 echo -e "\nlist EAs: should be no EAs left now"
133 getfattr -d $file
134
135 echo -e "\nunmount the FS and see if EAs are persistent"
136 _test_cycle_mount
137
138 echo -e "\nlist EAs: should still be no EAs left"
139 getfattr -d $file
140
141 # success, all done
142 status=0
143 exit