Files
apfstests/tests/generic/530
T
Darrick J. Wong afeb3b711c generic/530, xfs/501: pass fs shutdown handle to t_open_tmpfiles
So it turns out that overlayfs can't pass FS_IOC_SHUTDOWN to the lower
filesystems and so xfstests works around this by creating shutdown
helpers for the scratch fs to direct the shutdown ioctl to wherever it
needs to go to shut down the filesystem -- SCRATCH_MNT on normal
filesystems and OVL_BASE_SCRATCH_MNT when -overlay is enabled.  This
means that t_open_tmpfiles cannot simply use one of the open tempfiles
to shut down the filesystem.

Commit f8f5774722 tried to "fix" this by ripping the shutdown code out,
but this made the tests useless.  Fix this instead by creating a
xfstests helper to return a path that can be used to shut down the
filesystem and then pass that path to t_open_tmpfiles so that we can
shut down the filesystem when overlayfs is enabled.

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>
2019-05-24 17:18:16 +08:00

66 lines
1.7 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2019 Oracle, Inc. All Rights Reserved.
#
# FS QA Test No. 530
#
# Stress test creating a lot of unlinked O_TMPFILE files and recovering them
# after a crash, checking that we don't blow up the filesystem. This is sort
# of a performance test for the xfs unlinked inode backref patchset, but it
# applies to most other filesystems.
#
# Use only a single CPU to test the single threaded situation.
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
tmp=/tmp/$$
status=1 # failure is the default!
testfile=$TEST_DIR/$seq.txt
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
# real QA test starts here
_supported_fs generic
_supported_os Linux
_require_scratch
_require_scratch_shutdown
_require_test_program "t_open_tmpfiles"
rm -f $seqres.full
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount
# Set ULIMIT_NOFILE to min(file-max / 2, 50000 files per LOAD_FACTOR)
# so that this test doesn't take forever or OOM the box
max_files=$((50000 * LOAD_FACTOR))
max_allowable_files=$(( $(cat /proc/sys/fs/file-max) / 2 ))
test $max_allowable_files -gt 0 && test $max_files -gt $max_allowable_files && \
max_files=$max_allowable_files
ulimit -n $max_files
# Open a lot of unlinked files
echo create >> $seqres.full
$here/src/t_open_tmpfiles $SCRATCH_MNT $(_scratch_shutdown_handle) >> $seqres.full
# Unmount to prove that we can clean it all
echo umount >> $seqres.full
before=$(date +%s)
_scratch_unmount
after=$(date +%s)
echo "Unmount took $((after - before))s." >> $seqres.full
# Mount so that we can run the usual checks
echo silence is golden
_scratch_mount
status=0
exit