2 # FS QA Test No. generic/026
4 # Test out ACL count limits
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
8 # Copyright (c) 2014 Red hat, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=1 # FAILure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
44 [ -n "$TEST_DIR" ] && rm -rf $TEST_DIR/$seq.dir1
47 # real QA test starts here
64 # we return E2BIG if hit the max acl limits on new kernel, but EINVAL
65 # on old kernel. So we need to filter out the error message in order
66 # to make the updated golden output works for both old and new kernels.
69 sed -e "s/Invalid argument/Argument list too long/"
72 # filter all the non-ace stuff from the acl output so the count is
73 # correct. Note that this assumes that _create_n_aces always creates rwx acls.
76 _filter_aces | grep ':rwx'
79 # store the output in seqres.full, then run again an count and filter the
86 chacl $_acl largeaclfile 2>&1 | _filter_largeacl
87 getfacl --numeric largeaclfile | _filter_aces \
88 >> $seqres.full 2> /dev/null
89 nacls=`getfacl --numeric largeaclfile | _filter_acls | wc -l`
90 if [ $nacls -ne $_count ]; then
91 echo Wrong ACL count - $nacls != $_count
97 echo "=== Test out large ACLs ==="
100 ACL_MAX_ENTRIES=$(_acl_get_max)
101 num_aces_pre=$((ACL_MAX_ENTRIES - 1))
102 num_aces_post=$((ACL_MAX_ENTRIES + 1))
104 acl1=`_create_n_aces $num_aces_pre`
105 acl2=`_create_n_aces $ACL_MAX_ENTRIES`
106 acl3=`_create_n_aces $num_aces_post`
107 acl4=`_create_n_aces 16` # Andreas G. libacl size for initial get
108 acl5=`_create_n_aces 17` # 1 over A.G. libacl initial size
110 echo "1 below acl max"
111 check_acls $acl1 $num_aces_pre
114 check_acls $acl2 $ACL_MAX_ENTRIES
116 # we expect the ACL change to fail, so the old ACLs should remain on the
117 # file. Hence the expected ACL count is XFS_ACL_MAX_ENTRIES, not num_aces_post.
118 echo "1 above acl max"
119 check_acls $acl3 $ACL_MAX_ENTRIES