1#!/bin/sh 2 3# 4# Copyright (c) 2025 Peter Holm <pho@FreeBSD.org> 5# 6# SPDX-License-Identifier: BSD-2-Clause 7# 8 9[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 10 11. ../default.cfg 12 13mounts=15 # Number of parallel scripts 14mdstart=$mdstart # Use md unit numbers from this point 15 16if [ $# -eq 0 ]; then 17 for i in `jot $mounts`; do 18 m=$(( i + mdstart - 1 )) 19 [ ! -d ${mntpoint}$m ] && mkdir ${mntpoint}$m 20 mount | grep "$mntpoint" | grep -q md$m && umount ${mntpoint}$m 21 done 22 ../testcases/swap/swap -t 2m -i 20 & 23 24 # start the parallel tests 25 touch /tmp/$0 26 for i in `jot $mounts`; do 27 m=$(( i + mdstart - 1 )) 28 ./$0 $m & 29 ./$0 find $m > /dev/null 2>&1 & 30 done 31 wait 32else 33 if [ $1 = find ]; then 34 while [ -r /tmp/$0 ]; do 35 ls -lR ${mntpoint}* 36 done 37 else 38 39 # The test: Parallel mount and unmounts 40 start=`date +%s` 41 while [ $((`date +%s` - start)) -lt 120 ]; do 42 m=$1 43 mount -t fdescfs null ${mntpoint}$m 44 while mount | grep -qw $mntpoint$m; do 45 opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-f") 46 umount $opt ${mntpoint}$m > /dev/null 2>&1 47 done 48 done 49 rm -f /tmp/$0 50 fi 51fi 52