2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Oracle, Inc. All Rights Reserved.
7 # Check that we can't swapon a reflinked file.
10 _begin_fstest auto quick clone swap
12 _register_cleanup "_cleanup" BUS
14 # Override the default cleanup function.
22 # Import common functions.
26 # real QA test starts here
27 _require_scratch_swapfile
28 _require_scratch_reflink
31 echo "Format and mount"
32 _scratch_mkfs > $seqres.full 2>&1
33 _scratch_mount >> $seqres.full 2>&1
35 testdir=$SCRATCH_MNT/test-$seq
41 echo "Initialize file"
42 _format_swapfile "$testdir/file1" $((blocks * blksz)) > /dev/null
43 touch "$testdir/file2"
44 $CHATTR_PROG +C "$testdir/file2" >/dev/null 2>&1
45 _cp_reflink $testdir/file1 $testdir/file2 2>&1 | _filter_scratch
48 swapon $testdir/file1 2>&1 | _filter_scratch
50 swapoff $testdir/file1 >> $seqres.full 2>&1