Files
apfstests/tests/generic/338
T
Darrick J. Wong 26cfcac295 generic/338: don't check fs after crashing it
This test tries to make the filesystem go down by setting up
dm-error and committing metadata updates.  Since the test doesn't
remount the fs after it goes down to recover the log, this can
result in a dirty log being presented to the post-test filesystem
check if the filesystem is xfs and quotas are enabled.

Since this is a regression test for a NULL pointer dereference in
the kernel after the fs goes down, simply skip the post-test fsck.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-07-14 19:42:26 +08:00

66 lines
1.5 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2016 Red Hat Inc., All Rights Reserved.
#
# FS QA Test 338
#
# Test I/O on dm error device.
#
# Motivated by an ext4 bug that crashes kernel on error path when trying to
# update atime.
#
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.*
_dmerror_cleanup
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/dmerror
# remove previous $seqres.full before test
rm -f $seqres.full
# real QA test starts here
_supported_fs generic
_supported_os Linux
_require_scratch_nocheck # fs went down with a dirty log, don't check it
_require_dm_target error
# If SCRATCH_DEV is not a valid block device, FSTYP cannot be mkfs'ed either
_require_block_device $SCRATCH_DEV
echo "Silence is golden"
_scratch_mkfs >>$seqres.full 2>&1
_dmerror_init
# Use strictatime mount option here to force atime updates, which could help
# trigger the NULL pointer dereference on ext4 more easily
_dmerror_mount "-o strictatime"
_dmerror_load_error_table
# flush dmerror block device buffers and drop all caches, force reading from
# error device
blockdev --flushbufs $DMERROR_DEV
echo 3 > /proc/sys/vm/drop_caches
# do some test I/O
ls -l $SCRATCH_MNT >>$seqres.full 2>&1
$XFS_IO_PROG -fc "pwrite 0 1M" $SCRATCH_MNT/testfile >>$seqres.full 2>&1
# no panic no hang, success, all done
status=0
exit