generic: copy_file_range swapfile test
authorAmir Goldstein <amir73il@gmail.com>
Sun, 2 Jun 2019 12:41:11 +0000 (15:41 +0300)
committerEryu Guan <guaneryu@gmail.com>
Fri, 7 Jun 2019 17:13:45 +0000 (01:13 +0800)
Check that we cannot copy_file_range() to/from a swapfile.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/554 [new file with mode: 0755]
tests/generic/554.out [new file with mode: 0644]
tests/generic/group

diff --git a/tests/generic/554 b/tests/generic/554
new file mode 100755 (executable)
index 0000000..10ae403
--- /dev/null
@@ -0,0 +1,54 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2018 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 554
+#
+# Check that we cannot copy_file_range() to/from a swapfile
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs generic
+
+rm -f $seqres.full
+
+_require_scratch
+_require_xfs_io_command "copy_range"
+_require_scratch_swapfile
+
+_scratch_mkfs 2>&1 >> $seqres.full
+_scratch_mount
+
+rm -f $seqres.full
+
+$XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $SCRATCH_MNT/file >> $seqres.full 2>&1
+
+echo swap files return ETXTBUSY
+_format_swapfile $SCRATCH_MNT/swapfile 16m
+swapon $SCRATCH_MNT/swapfile
+$XFS_IO_PROG -f -c "copy_range -l 32k $SCRATCH_MNT/file" $SCRATCH_MNT/swapfile
+$XFS_IO_PROG -f -c "copy_range -l 32k $SCRATCH_MNT/swapfile" $SCRATCH_MNT/copy
+swapoff $SCRATCH_MNT/swapfile
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/554.out b/tests/generic/554.out
new file mode 100644 (file)
index 0000000..ffaa7b0
--- /dev/null
@@ -0,0 +1,4 @@
+QA output created by 554
+swap files return ETXTBUSY
+copy_range: Text file busy
+copy_range: Text file busy
index fe63b1cd3db27413809ed76003a9a2af21e4d0a1..44ce8eff9adc71a12ebda5bcdd2490217709c8a0 100644 (file)
 551 auto stress aio
 552 auto quick log
 553 auto quick copy_range
+554 auto quick copy_range swap