lib/: spdx license conversion
[xfstests-dev.git] / tests / nfs / 001
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc., All Rights Reserved.
4 #
5 # FS QA Test 001
6 #
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.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.* $acltest.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # remove previous $seqres.full before test
32 rm -f $seqres.full
33
34 # real QA test starts here
35 _supported_fs nfs
36 _supported_os Linux
37 _require_test_nfs_version 4
38 _require_command $NFS4_SETFACL_PROG "nfs4_setfacl"
39 _require_command $NFS4_GETFACL_PROG "nfs4_getfacl"
40
41 acltest=$TEST_DIR/acltest.$seq
42 rm -f $acltest.*
43 touch $acltest.file $acltest.list
44
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
52
53 # Save ACL to testfile
54 $NFS4_SETFACL_PROG -S $acltest.list $acltest.file
55
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
59
60 # success, all done
61 status=0
62 exit