xref: /freebsd/tools/test/stress2/misc/mount7.sh (revision 4f4b483d310058bd45323e3721e374724c1ccf0c)
1a526ec43SPeter Holm#!/bin/sh
2a526ec43SPeter Holm#
34d846d26SWarner Losh# SPDX-License-Identifier: BSD-2-Clause
4a526ec43SPeter Holm#
5a526ec43SPeter Holm# Copyright (c) 2022 Peter Holm <pho@FreeBSD.org>
6a526ec43SPeter Holm#
7a526ec43SPeter Holm# Redistribution and use in source and binary forms, with or without
8a526ec43SPeter Holm# modification, are permitted provided that the following conditions
9a526ec43SPeter Holm# are met:
10a526ec43SPeter Holm# 1. Redistributions of source code must retain the above copyright
11a526ec43SPeter Holm#    notice, this list of conditions and the following disclaimer.
12a526ec43SPeter Holm# 2. Redistributions in binary form must reproduce the above copyright
13a526ec43SPeter Holm#    notice, this list of conditions and the following disclaimer in the
14a526ec43SPeter Holm#    documentation and/or other materials provided with the distribution.
15a526ec43SPeter Holm#
16a526ec43SPeter Holm# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17a526ec43SPeter Holm# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18a526ec43SPeter Holm# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19a526ec43SPeter Holm# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20a526ec43SPeter Holm# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21a526ec43SPeter Holm# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22a526ec43SPeter Holm# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23a526ec43SPeter Holm# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24a526ec43SPeter Holm# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25a526ec43SPeter Holm# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26a526ec43SPeter Holm# SUCH DAMAGE.
27a526ec43SPeter Holm#
28a526ec43SPeter Holm
29a526ec43SPeter Holm# Another parallel mount(8) test scenario
30a526ec43SPeter Holm
31*4f4b483dSPeter Holm# Seen:
32*4f4b483dSPeter Holm#  UID   PID  PPID C PRI NI   VSZ  RSS MWCHAN  STAT TT     TIME COMMAND
33*4f4b483dSPeter Holm#  0 37225 99871 1  32  0 13280 3116 sdstart D+    0  0:00.04 mount /dev/md21 /mnt21
34*4f4b483dSPeter Holm#  0 37236 99550 9  68  0 13280 3112 sdstart D+    0  0:00.04 mount /dev/md19 /mnt19
35*4f4b483dSPeter Holm
36*4f4b483dSPeter Holm# https://people.freebsd.org/~pho/stress/log/log0549.txt
37*4f4b483dSPeter Holm# Fixed by kib@ in 4b273a7fb9e6
38*4f4b483dSPeter Holm
39a526ec43SPeter Holm. ../default.cfg
40a526ec43SPeter Holm
41a526ec43SPeter Holmmounts=15
42a526ec43SPeter Holm
43a526ec43SPeter Holm../testcases/swap/swap -t 2m -i 20 &
44a526ec43SPeter Holmfor i in `jot $mounts $mdstart`; do
45a526ec43SPeter Holm	mdconfig -a -s 50m -u $i
46a526ec43SPeter Holm	newfs -U /dev/md$i > /dev/null
47a526ec43SPeter Holm	mkdir -p $mntpoint$i
48a526ec43SPeter Holm	start=`date +%s`
49a526ec43SPeter Holm	while [ $((`date +%s` - start)) -lt 120 ]; do
50a526ec43SPeter Holm		mount /dev/md$i $mntpoint$i && cp /etc/passwd $mntpoint$i
51a526ec43SPeter Holm		while mount | grep -q " on $mntpoint$i "; do
52a526ec43SPeter Holm			umount $mntpoint$i > /dev/null 2>&1
53a526ec43SPeter Holm		done
54a526ec43SPeter Holm	done &
55a526ec43SPeter Holm	while [ $((`date +%s` - start)) -lt 120 ]; do
56a526ec43SPeter Holm		find $mntpoint$i -ls > /dev/null 2>&1
57a526ec43SPeter Holm	done &
58a526ec43SPeter Holmdone
59a526ec43SPeter Holmwait
60a526ec43SPeter Holm
61a526ec43SPeter Holmfor i in `jot $mounts $mdstart`; do
62a526ec43SPeter Holm	mdconfig -d -u $i
63a526ec43SPeter Holm	rmdir  $mntpoint$i
64a526ec43SPeter Holmdone
65a526ec43SPeter Holmexit $s
66