2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc. All Rights Reserved.
7 # Ensure that ctime is updated and capabilities are cleared when reflinking.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
13 status=1 # failure is the default!
14 trap "_cleanup; exit \$status" 0 1 2 3 15
22 # get standard environment, filters and checks
27 # real QA test starts here
29 _require_scratch_reflink
30 _require_command "$GETCAP_PROG" getcap
31 _require_command "$SETCAP_PROG" setcap
35 _scratch_mkfs >>$seqres.full 2>&1
38 $XFS_IO_PROG -f -c "pwrite -S 0x18 0 1m" $SCRATCH_MNT/foo >>$seqres.full
39 $XFS_IO_PROG -f -c "pwrite -S 0x20 0 1m" $SCRATCH_MNT/bar >>$seqres.full
41 $SETCAP_PROG cap_setgid,cap_setuid+ep $SCRATCH_MNT/bar
43 before_cap="$(_getcap -v $SCRATCH_MNT/bar)"
44 before_ctime="$(stat -c '%z' $SCRATCH_MNT/bar)"
48 $XFS_IO_PROG -c "reflink $SCRATCH_MNT/foo" $SCRATCH_MNT/bar >> $seqres.full 2>&1
50 after_cap="$(_getcap -v $SCRATCH_MNT/bar)"
51 after_ctime="$(stat -c '%z' $SCRATCH_MNT/bar)"
53 echo "$before_cap $before_ctime" >> $seqres.full
54 echo "$after_cap $after_ctime" >> $seqres.full
56 test "$before_cap" != "$after_cap" || echo "Expected capabilities to drop."
57 test "$before_ctime" != "$after_ctime" || echo "Expected ctime to change."
59 echo Silence is golden.