2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat, Inc. All Rights Reserved.
7 # Check that we cannot copy_file_range() to/from a swapfile
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 7 15
24 # get standard environment, filters and checks
28 # real QA test starts here
35 _require_xfs_io_command "copy_range"
36 _require_scratch_swapfile
38 _scratch_mkfs 2>&1 >> $seqres.full
43 $XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $SCRATCH_MNT/file >> $seqres.full 2>&1
45 echo swap files return ETXTBUSY
46 _format_swapfile $SCRATCH_MNT/swapfile 16m
47 swapon $SCRATCH_MNT/swapfile
48 $XFS_IO_PROG -f -c "copy_range -l 32k $SCRATCH_MNT/file" $SCRATCH_MNT/swapfile
49 $XFS_IO_PROG -f -c "copy_range -l 32k $SCRATCH_MNT/swapfile" $SCRATCH_MNT/copy
50 swapoff $SCRATCH_MNT/swapfile