The branch main has been updated by pho:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=da20d88599d52667c9cd422632302cf5e2e19938

commit da20d88599d52667c9cd422632302cf5e2e19938
Author:     Peter Holm <p...@freebsd.org>
AuthorDate: 2025-09-16 09:21:04 +0000
Commit:     Peter Holm <p...@freebsd.org>
CommitDate: 2025-09-16 09:21:04 +0000

    stress2: Added two new fdescfs test scenarios
---
 tools/test/stress2/misc/fdescfs2.sh | 44 ++++++++++++++++++++++++++++++++
 tools/test/stress2/misc/fdescfs3.sh | 51 +++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)

diff --git a/tools/test/stress2/misc/fdescfs2.sh 
b/tools/test/stress2/misc/fdescfs2.sh
new file mode 100755
index 000000000000..21b82dcddd5e
--- /dev/null
+++ b/tools/test/stress2/misc/fdescfs2.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2025 Peter Holm <p...@freebsd.org>
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+
+# Test scenario description by: Kyle Evans <kev...@freebsd.org>
+
+# "panic: mtx_lock() of destroyed mutex 0xffffffff83717540 @ 
/usr/src/sys/fs/fdescfs/fdesc_vnops.c:151" seen
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+. ../default.cfg
+
+set -u
+
+kldstat | grep -q fdescfs.ko && { kldunload fdescfs.ko && wasloaded=1; }
+while true; do
+       mount | grep -q "on $mntpoint " ||
+               mount -t fdescfs dummy $mntpoint || continue
+       ls $mntpoint > /dev/null
+       if mount | grep -q "on $mntpoint "; then
+               if ! umount $mntpoint; then
+                       umount -f $mntpoint || break
+               fi
+       fi
+done > /dev/null 2>&1 &
+
+start=`date +%s`
+while [ $((`date +%s` - start)) -lt 10 ]; do
+       kldstat | grep -q fdescfs.ko &&
+               kldunload fdescfs.ko 2>/dev/null
+       sleep .1
+       kldstat | grep -q fdescfs.ko ||
+               kldload fdescfs.ko
+done
+kill %1
+wait
+mount | grep -q "on $mntpoint " && umount $mntpoint
+sleep .1
+set +u
+[ $wasloaded ] || kldunload fdescfs.ko
+exit 0
diff --git a/tools/test/stress2/misc/fdescfs3.sh 
b/tools/test/stress2/misc/fdescfs3.sh
new file mode 100755
index 000000000000..eb24a6eac085
--- /dev/null
+++ b/tools/test/stress2/misc/fdescfs3.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2025 Peter Holm <p...@freebsd.org>
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+mounts=15              # Number of parallel scripts
+mdstart=$mdstart       # Use md unit numbers from this point
+
+if [ $# -eq 0 ]; then
+       for i in `jot $mounts`; do
+               m=$(( i + mdstart - 1 ))
+               [ ! -d ${mntpoint}$m ] && mkdir ${mntpoint}$m
+               mount | grep "$mntpoint" | grep -q md$m && umount ${mntpoint}$m
+       done
+       ../testcases/swap/swap -t 2m -i 20 &
+
+       # start the parallel tests
+       touch /tmp/$0
+       for i in `jot $mounts`; do
+               m=$(( i + mdstart - 1 ))
+               ./$0 $m &
+               ./$0 find $m > /dev/null 2>&1 &
+       done
+       wait
+else
+       if [ $1 = find ]; then
+               while [ -r /tmp/$0 ]; do
+                       ls -lR ${mntpoint}*
+               done
+       else
+
+               # The test: Parallel mount and unmounts
+               start=`date +%s`
+               while [ $((`date +%s` - start)) -lt 120 ]; do
+                       m=$1
+                       mount -t fdescfs null ${mntpoint}$m
+                       while mount | grep -qw $mntpoint$m; do
+                               opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo 
"-f")
+                               umount $opt ${mntpoint}$m > /dev/null 2>&1
+                       done
+               done
+               rm -f /tmp/$0
+       fi
+fi

Reply via email to