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
35 _require_command "$SETCAP_PROG" setcap
36 _require_command "$GETCAP_PROG" getcap
37 _require_scratch_overlay_features metacopy
39 # Remove all files from previous tests
43 lowerdir=${OVL_BASE_SCRATCH_MNT}/${OVL_LOWER}
44 echo "This is lower1" >> ${lowerdir}/file1
45 echo "This is lower2" >> ${lowerdir}/file2
48 $SETCAP_PROG cap_setuid+ep ${lowerdir}/file1
49 $SETCAP_PROG cap_setuid+ep ${lowerdir}/file2
51 _scratch_mount "-o metacopy=on"
53 # Trigger file copy up without actually writing anything to file. This
54 # requires opening file with WRITE and xfs_io opens file with
56 $XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/file1 >>$seqres.full
58 # Make sure cap_setuid is still there
59 $GETCAP_PROG ${SCRATCH_MNT}/file1 | _filter_scratch
61 # Trigger metadata only copy-up
62 chmod 000 ${SCRATCH_MNT}/file2
64 # Trigger data copy-up
65 $XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/file2 >>$seqres.full
67 # Make sure cap_setuid is still there
68 $GETCAP_PROG ${SCRATCH_MNT}/file2 | _filter_scratch