xref: /freebsd/tools/test/stress2/misc/tmpfs27.sh (revision 2e2699c48a7e6b7cbf13611a601a6cd264a80ec5)
1*2e2699c4SPeter Holm#!/bin/sh
2*2e2699c4SPeter Holm
3*2e2699c4SPeter Holm#
4*2e2699c4SPeter Holm# Copyright (c) 2024 Peter Holm <pho@FreeBSD.org>
5*2e2699c4SPeter Holm#
6*2e2699c4SPeter Holm# SPDX-License-Identifier: BSD-2-Clause
7*2e2699c4SPeter Holm#
8*2e2699c4SPeter Holm
9*2e2699c4SPeter Holm# umount FS with memory mapped file. tmpfs version.
10*2e2699c4SPeter Holm
11*2e2699c4SPeter Holm# "panic: object with writable mappings does not have a reference" seen:
12*2e2699c4SPeter Holm# https://people.freebsd.org/~pho/stress/log/log0518.txt
13*2e2699c4SPeter Holm
14*2e2699c4SPeter Holm[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
15*2e2699c4SPeter Holm
16*2e2699c4SPeter Holm. ../default.cfg
17*2e2699c4SPeter Holm
18*2e2699c4SPeter Holmset -eu
19*2e2699c4SPeter Holmprog=$(basename "$0" .sh)
20*2e2699c4SPeter Holmhere=`pwd`
21*2e2699c4SPeter Holmmp1=$mntpoint
22*2e2699c4SPeter Holm
23*2e2699c4SPeter Holmmount -t tmpfs dummy $mp1
24*2e2699c4SPeter Holm
25*2e2699c4SPeter Holmexport RUNDIR=$mp1/stressX
26*2e2699c4SPeter Holmexport runRUNTIME=2m
27*2e2699c4SPeter Holmexport LOAD=70
28*2e2699c4SPeter Holmexport mmapLOAD=100
29*2e2699c4SPeter Holmexport TESTPROGS="testcases/mmap/mmap testcases/swap/swap"
30*2e2699c4SPeter Holmset +e
31*2e2699c4SPeter Holm
32*2e2699c4SPeter Holm(cd ..; ./testcases/run/run $TESTPROGS > /dev/null 2>&1) & rpid=$!
33*2e2699c4SPeter Holmsleep 5
34*2e2699c4SPeter Holm
35*2e2699c4SPeter Holmstart=`date +%s`
36*2e2699c4SPeter Holmwhile [ $((`date +%s` - start)) -lt 120 ]; do
37*2e2699c4SPeter Holm	umount -f $mp1 &&
38*2e2699c4SPeter Holm	    mount -t tmpfs dummy $mp1
39*2e2699c4SPeter Holm	mount | grep -q "on $mp1 " || break
40*2e2699c4SPeter Holm	pgrep -q mmap || break
41*2e2699c4SPeter Holmdone
42*2e2699c4SPeter Holmpkill run swap mmap
43*2e2699c4SPeter Holmwhile pgrep -q swap; do pkill swap; done
44*2e2699c4SPeter Holmwait $rpid
45*2e2699c4SPeter Holm
46*2e2699c4SPeter Holmwhile mount | grep -q "on $mp1 "; do
47*2e2699c4SPeter Holm	umount $mp1
48*2e2699c4SPeter Holmdone
49*2e2699c4SPeter Holmexit 0
50