2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 Red Hat Inc. All Rights Reserved.
7 # Make sure CAP_SETUID is not cleared over file copy up.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
28 # remove previous $seqres.full before test
31 # real QA test starts here
34 _require_command "$SETCAP_PROG" setcap
35 _require_command "$GETCAP_PROG" getcap
36 _require_scratch_overlay_features metacopy
38 # Remove all files from previous tests
42 lowerdir=${OVL_BASE_SCRATCH_MNT}/${OVL_LOWER}
43 echo "This is lower1" >> ${lowerdir}/file1
44 echo "This is lower2" >> ${lowerdir}/file2
47 $SETCAP_PROG cap_setuid+ep ${lowerdir}/file1
48 $SETCAP_PROG cap_setuid+ep ${lowerdir}/file2
50 _scratch_mount "-o metacopy=on"
52 # Trigger file copy up without actually writing anything to file. This
53 # requires opening file with WRITE and xfs_io opens file with
55 $XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/file1 >>$seqres.full
57 # Make sure cap_setuid is still there
58 _getcap ${SCRATCH_MNT}/file1 | _filter_scratch
60 # Trigger metadata only copy-up
61 chmod 000 ${SCRATCH_MNT}/file2
63 # Trigger data copy-up
64 $XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/file2 >>$seqres.full
66 # Make sure cap_setuid is still there
67 _getcap ${SCRATCH_MNT}/file2 | _filter_scratch