generic: test deadlock on O_DIRECT|O_DSYNC
[xfstests-dev.git] / tests / generic / 363
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 363
6 #
7 # RichACL auto-inheritance test
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26
27 # remove previous $seqres.full before test
28 rm -f $seqres.full
29
30 # real QA test starts here
31
32 _supported_fs generic
33 _supported_os Linux
34
35 _require_scratch
36 _require_scratch_richacl
37 _require_richacl_prog
38
39 _scratch_mkfs_richacl >> $seqres.full
40 _scratch_mount
41
42 cd $SCRATCH_MNT
43
44 umask 022
45
46 mkdir d1
47 $SETRICHACL_PROG --modify owner@:rwpxd:fd:allow,u:101:rw:fd:deny d1
48 $SETRICHACL_PROG --modify u:102:rw:f:deny d1
49 $SETRICHACL_PROG --modify u:103:rw:d:deny d1
50 $SETRICHACL_PROG --modify g:101:rw:fdi:deny d1
51
52 $SETRICHACL_PROG --modify flags:a d1
53
54 $GETRICHACL_PROG --numeric --raw d1
55
56 mkdir d1/d2
57 touch d1/d3
58
59 # Mode bits derived from inherited ACEs
60 $GETRICHACL_PROG --numeric --raw d1/d2
61
62 $GETRICHACL_PROG --numeric --raw d1/d3
63
64 mkdir d1/d2/d4
65 touch d1/d2/d4/d5
66
67 # Protected files
68 mkdir d1/d6
69 touch d1/d7
70
71 $GETRICHACL_PROG --numeric --raw d1/d2/d4
72
73 $GETRICHACL_PROG --numeric --raw d1/d2/d4/d5
74
75 # Clear protected flag from all the ACLs
76 $SETRICHACL_PROG --modify flags:a d1/d2
77 $SETRICHACL_PROG --modify flags:a d1/d3
78 $SETRICHACL_PROG --modify flags:a d1/d2/d4
79 $SETRICHACL_PROG --modify flags:a d1/d2/d4/d5
80
81 $GETRICHACL_PROG --numeric d1 | sed -e 's/:fd:deny/:fd:allow/' > acl.txt
82 cat acl.txt
83
84 $SETRICHACL_PROG --set-file acl.txt d1
85
86 $GETRICHACL_PROG --numeric --raw d1
87
88 $GETRICHACL_PROG --numeric --raw d1/d2
89
90 $GETRICHACL_PROG --numeric --raw d1/d3
91
92 $GETRICHACL_PROG --numeric --raw d1/d2/d4
93
94 $GETRICHACL_PROG --numeric --raw d1/d2/d4/d5
95
96 # No automatic inheritance for protected files
97 $GETRICHACL_PROG --numeric --raw d1/d6
98
99 $GETRICHACL_PROG --numeric --raw d1/d7
100
101 # success, all done
102 status=0
103 exit