mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
dff50e6084
It turns out that userspace actually does need the ability to write to an active swapfile if userspace hibernation (uswsusp) is enabled. Therefore, this test doesn't apply under those conditions. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
58 lines
1.3 KiB
Bash
Executable File
58 lines
1.3 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0-or-newer
|
|
# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. 570
|
|
#
|
|
# Check that we can't modify a block device that's an active swap device.
|
|
|
|
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 15
|
|
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
swapoff $SCRATCH_DEV
|
|
rm -rf $tmp.*
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
|
|
# real QA test starts here
|
|
_supported_os Linux
|
|
_supported_fs generic
|
|
_require_test_program swapon
|
|
_require_scratch_nocheck
|
|
_require_block_device $SCRATCH_DEV
|
|
test -e /dev/snapshot && _notrun "userspace hibernation to swap is enabled"
|
|
|
|
rm -f $seqres.full
|
|
|
|
$MKSWAP_PROG "$SCRATCH_DEV" >> $seqres.full
|
|
|
|
# Can you modify the swap dev via previously open file descriptors?
|
|
for verb in 1 2 3 4; do
|
|
echo "verb $verb"
|
|
"$here/src/swapon" -v $verb $SCRATCH_DEV
|
|
swapoff $SCRATCH_DEV
|
|
done
|
|
|
|
swapon $SCRATCH_DEV 2>&1 | _filter_scratch
|
|
|
|
# Can we write to it?
|
|
$XFS_IO_PROG -c 'pwrite -S 0x59 64k 64k' $SCRATCH_DEV 2>&1 | _filter_xfs_io_error
|
|
$XFS_IO_PROG -d -c 'pwrite -S 0x60 64k 64k' $SCRATCH_DEV 2>&1 | _filter_xfs_io_error
|
|
$XFS_IO_PROG -c 'mmap -rw 64k 64k' -c 'mwrite -S 0x61 64k 64k' $SCRATCH_DEV
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|