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 _begin_fstest acl quick auto
13 # Import common functions.
17 # Override the default cleanup function.
22 [ -n "$TEST_DIR" ] && rm -rf $TEST_DIR/$seq.dir1
25 # real QA test starts here
38 # we return E2BIG if hit the max acl limits on new kernel, but EINVAL
39 # on old kernel. So we need to filter out the error message in order
40 # to make the updated golden output works for both old and new kernels.
43 sed -e "s/Invalid argument/Argument list too long/"
46 # filter all the non-ace stuff from the acl output so the count is
47 # correct. Note that this assumes that _create_n_aces always creates rwx acls.
50 _filter_aces | grep ':rwx'
53 # store the output in seqres.full, then run again an count and filter the
60 chacl $_acl largeaclfile 2>&1 | _filter_largeacl
61 getfacl --numeric largeaclfile | _filter_aces \
62 >> $seqres.full 2> /dev/null
63 nacls=`getfacl --numeric largeaclfile | _filter_acls | wc -l`
64 if [ $nacls -ne $_count ]; then
65 echo Wrong ACL count - $nacls != $_count
70 echo "=== Test out large ACLs ==="
73 ACL_MAX_ENTRIES=$(_acl_get_max)
74 num_aces_pre=$((ACL_MAX_ENTRIES - 1))
75 num_aces_post=$((ACL_MAX_ENTRIES + 1))
77 acl1=`_create_n_aces $num_aces_pre`
78 acl2=`_create_n_aces $ACL_MAX_ENTRIES`
79 acl3=`_create_n_aces $num_aces_post`
80 acl4=`_create_n_aces 16` # Andreas G. libacl size for initial get
81 acl5=`_create_n_aces 17` # 1 over A.G. libacl initial size
83 echo "1 below acl max"
84 check_acls $acl1 $num_aces_pre
87 check_acls $acl2 $ACL_MAX_ENTRIES
89 # we expect the ACL change to fail, so the old ACLs should remain on the
90 # file. Hence the expected ACL count is XFS_ACL_MAX_ENTRIES, not num_aces_post.
91 echo "1 above acl max"
92 check_acls $acl3 $ACL_MAX_ENTRIES