2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
4 # Copyright (c) 2014 Red hat, Inc. All Rights Reserved.
6 # FS QA Test No. generic/026
8 # Test out ACL count limits
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # FAILure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
19 # get standard environment, filters and checks
28 [ -n "$TEST_DIR" ] && rm -rf $TEST_DIR/$seq.dir1
31 # real QA test starts here
47 # we return E2BIG if hit the max acl limits on new kernel, but EINVAL
48 # on old kernel. So we need to filter out the error message in order
49 # to make the updated golden output works for both old and new kernels.
52 sed -e "s/Invalid argument/Argument list too long/"
55 # filter all the non-ace stuff from the acl output so the count is
56 # correct. Note that this assumes that _create_n_aces always creates rwx acls.
59 _filter_aces | grep ':rwx'
62 # store the output in seqres.full, then run again an count and filter the
69 chacl $_acl largeaclfile 2>&1 | _filter_largeacl
70 getfacl --numeric largeaclfile | _filter_aces \
71 >> $seqres.full 2> /dev/null
72 nacls=`getfacl --numeric largeaclfile | _filter_acls | wc -l`
73 if [ $nacls -ne $_count ]; then
74 echo Wrong ACL count - $nacls != $_count
80 echo "=== Test out large ACLs ==="
83 ACL_MAX_ENTRIES=$(_acl_get_max)
84 num_aces_pre=$((ACL_MAX_ENTRIES - 1))
85 num_aces_post=$((ACL_MAX_ENTRIES + 1))
87 acl1=`_create_n_aces $num_aces_pre`
88 acl2=`_create_n_aces $ACL_MAX_ENTRIES`
89 acl3=`_create_n_aces $num_aces_post`
90 acl4=`_create_n_aces 16` # Andreas G. libacl size for initial get
91 acl5=`_create_n_aces 17` # 1 over A.G. libacl initial size
93 echo "1 below acl max"
94 check_acls $acl1 $num_aces_pre
97 check_acls $acl2 $ACL_MAX_ENTRIES
99 # we expect the ACL change to fail, so the old ACLs should remain on the
100 # file. Hence the expected ACL count is XFS_ACL_MAX_ENTRIES, not num_aces_post.
101 echo "1 above acl max"
102 check_acls $acl3 $ACL_MAX_ENTRIES