generic: test reflink side effects
PATCH v2 1/1 generic: test reflink side effects
From: Darrick J. Wong <[email protected]>
Test that ctime gets updated and suid is cleared when we reflink. Ensure we can't reflink about RLIMIT_FSIZE. Ensure that we can't expose stale preallocation block data when reflinking above EOF. Make sure dedupe actually catches a single different byte.
Signed-off-by Darrick J. Wong <[email protected]>
--- tests/generic/934 | 62 ++++++++++++++++++++++++++++++++++++++ tests/generic/934.out | 2 + tests/generic/935 | 49 ++++++++++++++++++++++++++++++ tests/generic/935.out | 2 + tests/generic/936 | 68 +++++++++++++++++++++++++++++++++++++++++ tests/generic/936.out | 5 +++ tests/generic/937 | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/937.out | 11 +++++++ tests/generic/group | 4 ++ 9 files changed, 284 insertions(+) create mode 100755 tests/generic/934 create mode 100644 tests/generic/934.out create mode 100755 tests/generic/935 create mode 100644 tests/generic/935.out create mode 100755 tests/generic/936 create mode 100644 tests/generic/936.out create mode 100755 tests/generic/937 create mode 100644 tests/generic/937.out
tests/generic/934 new file +62 -0
@@ -0,0 +1,62 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 934 +# +# Ensure that ctime is updated and capabilities are cleared when reflinking. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch_reflink +_require_command "$GETCAP_PROG" getcap +_require_command "$SETCAP_PROG" setcap + +rm -f $seqres.full + +_scratch_mkfs >>$seqres.full 2>&1 +_scratch_mount + +$XFS_IO_PROG -f -c "pwrite -S 0x18 0 1m" $SCRATCH_MNT/foo >>$seqres.full +$XFS_IO_PROG -f -c "pwrite -S 0x20 0 1m" $SCRATCH_MNT/bar >>$seqres.full + +$SETCAP_PROG cap_setgid,cap_setuid+ep $SCRATCH_MNT/bar + +before_cap="$($GETCAP_PROG -v $SCRATCH_MNT/bar)" +before_ctime="$(stat -c '%z' $SCRATCH_MNT/bar)" + +sleep 1 + +$XFS_IO_PROG -c "reflink $SCRATCH_MNT/foo" $SCRATCH_MNT/bar >> $seqres.full 2>&1 + +after_cap="$($GETCAP_PROG -v $SCRATCH_MNT/bar)" +after_ctime="$(stat -c '%z' $SCRATCH_MNT/bar)" + +echo "$before_cap $before_ctime" >> $seqres.full +echo "$after_cap $after_ctime" >> $seqres.full + +test "$before_cap" != "$after_cap" || echo "Expected capabilities to drop." +test "$before_ctime" != "$after_ctime" || echo "Expected ctime to change." + +echo Silence is golden. +status=0 +exit
tests/generic/934.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 934 +Silence is golden.
tests/generic/935 new file +49 -0
49 lines not on this page · raw message
tests/generic/935.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 935 +Silence is golden.
tests/generic/936 new file +68 -0
68 lines not on this page · raw message
tests/generic/936.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 936 +34a4daf52c562253a2f6108c5123605a SCRATCH_MNT/a +4fe4dfe3d2244bd380adcefdc5006e37 SCRATCH_MNT/b +34a4daf52c562253a2f6108c5123605a SCRATCH_MNT/a +4fe4dfe3d2244bd380adcefdc5006e37 SCRATCH_MNT/b
tests/generic/937 new file +81 -0
81 lines not on this page · raw message
tests/generic/937.out new file +11 -0
@@ -0,0 +1,11 @@ +QA output created by 937 +Create the original files +35ac8d7917305c385c30f3d82c30a8f6 TEST_DIR/test-937/file1 +39578c21e2cb9f6049b1cf7fc7be12a6 TEST_DIR/test-937/file2 +Files 1-2 do not match (intentional) +(partial) dedupe the middle blocks together +XFS_IOC_FILE_EXTENT_SAME: Extents did not match. +Compare sections +35ac8d7917305c385c30f3d82c30a8f6 TEST_DIR/test-937/file1 +39578c21e2cb9f6049b1cf7fc7be12a6 TEST_DIR/test-937/file2 +Middle sections do not match (intentional)
tests/generic/group +4 -0
@@ -514,3 +514,7 @@ 509 auto quick log 510 auto quick log 511 auto quick rw zero +934 auto quick clone +935 auto quick clone +936 auto quick clone +937 auto quick dedupe clone