2 # SPDX-License-Identifier: GPL-2.0-or-newer
3 # Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved.
7 # Check that we can't modify a block device that's an active swap device.
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 15
25 # get standard environment, filters and checks
29 # real QA test starts here
32 _require_test_program swapon
33 _require_scratch_nocheck
34 _require_block_device $SCRATCH_DEV
35 test -e /dev/snapshot && _notrun "userspace hibernation to swap is enabled"
39 $MKSWAP_PROG "$SCRATCH_DEV" >> $seqres.full
41 # Can you modify the swap dev via previously open file descriptors?
42 for verb in 1 2 3 4; do
44 "$here/src/swapon" -v $verb $SCRATCH_DEV
48 swapon $SCRATCH_DEV 2>&1 | _filter_scratch
51 $XFS_IO_PROG -c 'pwrite -S 0x59 64k 64k' $SCRATCH_DEV 2>&1 | _filter_xfs_io_error
52 $XFS_IO_PROG -d -c 'pwrite -S 0x60 64k 64k' $SCRATCH_DEV 2>&1 | _filter_xfs_io_error
53 $XFS_IO_PROG -c 'mmap -rw 64k 64k' -c 'mwrite -S 0x61 64k 64k' $SCRATCH_DEV