Files
apfstests/tests/generic/411
T
David Oberhollenzer 1cc2487f50 fstests: Fix block device requirements and manual scratch mounts
Some tests require the scratch volume to be a block device,
although they don't do anything block device specific like
the device mapper tests. They actually only require a local
device and fail with network or overlay pseudo mount devices.

The same tests also try to mount the scratch device manually
after running _scratch_mkfs. For UBIFS, _scratch_mkfs simply
truncates the UBI volume and relies on the kernel to re-format
the volume on the next mount. This fails if the fs type is not
specified explicitly when mounting.

This patch replaces the block device requirement with a
generic check for a local device and adds a filesystem
specification to all manual mounts of the scratch device
to a mount point.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-06-08 10:53:27 +08:00

151 lines
3.4 KiB
Bash
Executable File

#! /bin/bash
# FS QA Test 411
#
# This test cover linux commit 7ae8fd0, kernel two mnt_group_id == 0
# (no peer)vfsmount as peers. It case kernel dereference a NULL
# address.
#
#-----------------------------------------------------------------------
# Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#-----------------------------------------------------------------------
#
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 /
rm -f $tmp.*
_clear_mount_stack
# make sure there's no bug cause dentry isn't be freed
rm -rf $MNTHEAD
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# remove previous $seqres.full before test
rm -f $seqres.full
# real QA test starts here
_supported_fs generic
_supported_os Linux
_require_test
_require_scratch
_require_local_device $SCRATCH_DEV
fs_stress()
{
local target=$1
$FSSTRESS_PROG -z -n 500 -p 5 \
-f creat=5 \
-f mkdir=5 \
-f dwrite=1 \
-f dread=1 \
-f link=2 \
-f rename=1 \
-f rmdir=2 \
-f unlink=1 \
-f symlink=1 \
-f write=1 \
-f read=1 \
-f chown=1 \
-f getdents=1 \
-f fiemap=1 \
-d $target >/dev/null
sync
}
# prepare some mountpoint dir
MNTHEAD=$TEST_DIR/$seq
rm -rf $MNTHEAD
mkdir $MNTHEAD 2>>$seqres.full
mpA=$MNTHEAD/"$$"_mpA
mpB=$MNTHEAD/"$$"_mpB
mpC=$MNTHEAD/"$$"_mpC
find_mnt()
{
echo "------"
findmnt -n -o TARGET,SOURCE $SCRATCH_DEV | \
sed -e "s;$mpA;mpA;g" \
-e "s;$mpB;mpB;g" \
-e "s;$mpC;mpC;g" | \
_filter_spaces | _filter_scratch | \
_filter_test_dir | sort
echo "======"
}
start_test()
{
local type=$1
_scratch_mkfs >$seqres.full 2>&1
_get_mount -t $FSTYP $SCRATCH_DEV $MNTHEAD
$MOUNT_PROG --make-"${type}" $MNTHEAD
mkdir $mpA $mpB $mpC
}
end_test()
{
_clear_mount_stack
rm -rf $mpA $mpB $mpC
}
#
# shared New FS shared
# -----------------------[A/mnt1]----------------------
# | | |
# | bind | bind | New FS
# [C/mnt1]--[slave C]<------[shared A]------>[slave B]--[B/mnt1]--[B/mnt1/mnt2]
#
crash_test()
{
start_test shared
_get_mount -t $FSTYP $SCRATCH_DEV $mpA
mkdir $mpA/mnt1
$MOUNT_PROG --make-shared $mpA
_get_mount --bind $mpA $mpB
_get_mount --bind $mpA $mpC
$MOUNT_PROG --make-slave $mpB
$MOUNT_PROG --make-slave $mpC
_get_mount -t $FSTYP $SCRATCH_DEV $mpA/mnt1
mkdir $mpA/mnt1/mnt2
_get_mount -t $FSTYP $SCRATCH_DEV $mpB/mnt1/mnt2
find_mnt
fs_stress $mpB/mnt1/mnt2
end_test
echo "crash test passed"
}
crash_test
# success, all done
status=0
exit