Whamcloud - gitweb
LU-18030 tests: Add a test to ensure permissions copy on nfs 76/56176/8
authorOleg Drokin (aider) <green@whamcloud.com>
Wed, 28 Aug 2024 06:42:49 +0000 (02:42 -0400)
committerOleg Drokin <green@whamcloud.com>
Sun, 8 Sep 2024 16:06:02 +0000 (16:06 +0000)
Also ensure no empty POSIX ACL is created.

Test-Parameters: trivial testlist=parallel-scale-nfsv4,parallel-scale-nfsv3
Change-Id: I85d37f8eebd17d6acdb67c552fec2caa79dbd39c
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56176
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/parallel-scale-nfs.sh

index a35e6ff..fa2b6ca 100755 (executable)
@@ -101,6 +101,43 @@ get_mpiuser_id $MPI_USER
 MPI_RUNAS=${MPI_RUNAS:-"runas -u $MPI_USER_UID -g $MPI_USER_GID"}
 $GSS_KRB5 && refresh_krb5_tgt $MPI_USER_UID $MPI_USER_GID $MPI_RUNAS
 
+test_1() {
+       local src_file=/tmp/testfile.txt
+       local dst_file=$TESTDIR/$tfile
+       local native_file=$MOUNT/${dst_file#$NFS_CLIMNTPT}
+       local mode=644
+       local got
+
+       touch $src_file
+       chmod $mode $src_file
+
+       cp -p $src_file $dst_file || error "copy  $src_file->$dst_file failed"
+
+       stat $dst_file
+       got="$(stat -c %a $dst_file)"
+       [[ "$got" == "$mode" ]] || error "permissions mismatch on '$dst_file'"
+
+       local xattr=system.posix_acl_access
+       local lustre_xattrs=$(do_node $LUSTRE_CLIENT_NFSSRV \
+               "getfattr -d -m - -e hex $native_file")
+
+       echo $lustre_xattrs
+       # If this fails then the mountpoint is non-Lustre or does
+       # not exist because we failed to find a native mountpoint
+       [[ "$lustre_xattrs" =~ "trusted.link" ]] ||
+               error "no trusted.link xattr in '$native_file'"
+
+       [[ "$lustre_xattrs" =~ "$xattr" ]] &&
+               error "found unexpected $xattr in '$native_file'"
+
+       do_node $LUSTRE_CLIENT_NFSSRV "stat $native_file"
+       got=$(do_node $LUSTRE_CLIENT_NFSSRV "stat -c %a $native_file")
+       [[ "$got" == "$mode" ]] || error "permission mismatch on '$native_file'"
+
+       rm -f $src_file $dst_file
+}
+run_test 1 "test copy with attributes"
+
 test_compilebench() {
        if [[ "$TESTSUITE" =~ "parallel-scale-nfs" ]]; then
                skip "LU-12957 and LU-13068: compilebench for $TESTSUITE"