stress2: add two new unionfs test scenarios

These exercise lookup traversal from tmpfs into unionfs, which is
useful because, unlike UFS, tmpfs does not allow recursion on its vnode
locks by default.

unionfs22.sh exercises these lookups with a normal unionfs mount, while
unionfs23.sh uses '-o below' for the unionfs mount and reproduces the
panic described in PR 298201.

Reviewed by:	kib, markj, pho
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D59494
This commit is contained in:
Jason A. Harmening committed 2026-09-12 22:19:19 -05:00
1 parent f57ce26f25
commit 5fe1964fa0
2 files changed
+154

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
#!/bin/sh
#
# Copyright (c) 2024 Peter Holm <[email protected]>
# Copyright (c) 2026 Jason Harmening <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
#
# unionfs(4) test
# Variation of unionfs7.sh, but with unionfs lookup
# traversing a tmpfs mount.
# No issues seen with this test.
[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
. ../default.cfg
mp1=/mnt$mdstart
mp2=/mnt$((mdstart + 1))
mp3=$mp2/unionfs
mkdir -p $mp1 $mp2
set -e
for i in $mp1 $mp2; do
mount | grep -q "on $i " && umount -f $i
done
mount -o size=4g -t tmpfs dummy $mp1
mount -o size=4g -t tmpfs dummy $mp2
mkdir -p $mp3
mount -t unionfs -o noatime $mp1 $mp3
set +e
export 'INODES=100000'
export CTRLDIR=$mp3/stressX.control
export INCARNATIONS=10
export LOAD=80
export RUNDIR=$mp3/stressX
export runRUNTIME=5m
export rwLOAD=80
export symlinkLOAD=80
export TESTPROGS="
unionfs/stress2/testcases/lockf2/lockf2
unionfs/stress2/testcases/symlink/symlink
unionfs/stress2/testcases/openat/openat
unionfs/stress2/testcases/rw/rw
unionfs/stress2/testcases/fts/fts
unionfs/stress2/testcases/link/link
unionfs/stress2/testcases/lockf/lockf
unionfs/stress2/testcases/creat/creat
unionfs/stress2/testcases/mkdir/mkdir
unionfs/stress2/testcases/rename/rename
unionfs/stress2/testcases/mkfifo/mkfifo
unionfs/stress2/testcases/dirnprename/dirnprename
unionfs/stress2/testcases/dirrename/dirrename
unionfs/stress2/testcases/swap/swap
"
cp -r ../../stress2 $mp3
export TESTPROGS=`echo $TESTPROGS | sed 's/\n/ /g'`
set +e
chmod 777 $mp3
su $testuser -c \
"(cd $mp2; ./unionfs/stress2/testcases/run/run $TESTPROGS)"
while mount | grep -Eq "on $mp3 .*unionfs"; do
umount $mp3 && break
sleep 5
done
umount $mp2
n=`find $mp1/stressX | wc -l`
[ $n -eq 1 ] && s=0 || { find $mp1/stressX -ls | head -12; s=1; }
umount $mp1
exit $s
+77
View File
@@ -0,0 +1,77 @@
#!/bin/sh
#
# Copyright (c) 2024 Peter Holm <[email protected]>
# Copyright (c) 2026 Jason Harmening <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
#
# unionfs(4) test
# Variation of unionfs22.sh, but with '-o below'
# Reproduces "lockmgr_xlock_hard: recursing on non recursive lockmgr"
# panic (PR 298201)
[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
. ../default.cfg
mp1=/mnt$mdstart
mp2=/mnt$((mdstart + 1))
mp3=$mp2/unionfs
mkdir -p $mp1 $mp2
set -e
for i in $mp1 $mp2; do
mount | grep -q "on $i " && umount -f $i
done
mount -o size=4g -t tmpfs dummy $mp1
mount -o size=4g -t tmpfs dummy $mp2
mkdir -p $mp3
mount -t unionfs -o noatime -o below $mp1 $mp3
set +e
export 'INODES=100000'
export CTRLDIR=$mp3/stressX.control
export INCARNATIONS=10
export LOAD=80
export RUNDIR=$mp3/stressX
export runRUNTIME=5m
export rwLOAD=80
export symlinkLOAD=80
export TESTPROGS="
unionfs/stress2/testcases/lockf2/lockf2
unionfs/stress2/testcases/symlink/symlink
unionfs/stress2/testcases/openat/openat
unionfs/stress2/testcases/rw/rw
unionfs/stress2/testcases/fts/fts
unionfs/stress2/testcases/link/link
unionfs/stress2/testcases/lockf/lockf
unionfs/stress2/testcases/creat/creat
unionfs/stress2/testcases/mkdir/mkdir
unionfs/stress2/testcases/rename/rename
unionfs/stress2/testcases/mkfifo/mkfifo
unionfs/stress2/testcases/dirnprename/dirnprename
unionfs/stress2/testcases/dirrename/dirrename
unionfs/stress2/testcases/swap/swap
"
cp -r ../../stress2 $mp3
export TESTPROGS=`echo $TESTPROGS | sed 's/\n/ /g'`
set +e
chmod 777 $mp3
su $testuser -c \
"(cd $mp2; ./unionfs/stress2/testcases/run/run $TESTPROGS)"
while mount | grep -Eq "on $mp3 .*unionfs"; do
umount $mp3 && break
sleep 5
done
n=`find $mp3/stressX | wc -l`
[ $n -eq 1 ] && s=0 || { find $mp3/stressX -ls | head -12; s=1; }
umount $mp2
umount $mp1
exit $s