2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc., All Rights Reserved.
7 # Test nfs4_getfacl gets ACL list correctly from server when the ACL length is
8 # close enough to the end of a page. On buggy NFS client getxattr could return
9 # ERANGE. Upstream commit ed92d8c137b7 ("NFSv4: fix getacl ERANGE for some ACL
10 # buffer sizes") fixed this bug.
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
24 rm -f $tmp.* $acltest.*
27 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
37 _require_test_nfs_version 4
38 _require_command $NFS4_SETFACL_PROG "nfs4_setfacl"
39 _require_command $NFS4_GETFACL_PROG "nfs4_getfacl"
41 acltest=$TEST_DIR/acltest.$seq
43 touch $acltest.file $acltest.list
45 # Setup a carefully made ACE list to make attr buffer length is close enough to
46 # PAGE_SIZE (size is 4088 in this case, and this only works for 4k page size)
47 # that leaves too little room for adding extra attr bitmap in this page
48 echo "A::OWNER@:RW" >$acltest.list
49 for ((i=9802; i < 10002; i++)); do echo "A::$i:RW" >>$acltest.list; done
50 echo "A::GROUP@:RW" >>$acltest.list
51 echo "A::EVERYONE@:RW" >>$acltest.list
53 # Save ACL to testfile
54 $NFS4_SETFACL_PROG -S $acltest.list $acltest.file
56 # Dump ACL, expect correct number of ACE entries
57 $NFS4_GETFACL_PROG $acltest.file >>$seqres.full 2>&1
58 $NFS4_GETFACL_PROG $acltest.file | wc -l