From nobody Tue Apr 16 08:22:30 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VJcTy2b3Pz5G6tN; Tue, 16 Apr 2024 08:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VJcTy222Tz4tt0; Tue, 16 Apr 2024 08:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713255750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2WrBY3x+WL6IOyRKs2dAf8XzwLM1vW65ySHoOX1blG4=; b=IygyuFWZhrQR13zcN4gqMDSfbdLtZbXsfdK+n6rlC6FYCQx9N1sNVXp0dt/ggkiGd4vHRh 8pjyvk29WDhFz3pfL8xa8YgiQunflfPtsTXKDuQejgdp8B0AvU9MLtExB6dIo1XbFJAzLF R2lsVb2qnSIBuzfGKYkPjKJJVOwtwrdxJ9795ODyz/l61Us6TOG534OIKyC3yi7cprLcLm C8z3c+AAEe7bsNYTjPYNQRT9GpjilG1vvT6kN7mYccrt9HXcyXDv/fXAGn0Rv1YUr/rVd9 5fravJlp5vwEzmhCLmqZ/KFj78xCYQYkly0bkJrWzzh63M6xgHf9SsRdjIVVEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713255750; a=rsa-sha256; cv=none; b=ntw4GAORkUp/RqqQJnAzo/TpYNvYEiXvDVV9uSt7OSV5wfPbR7llxULQ+6MCG5ad7sZAWr yqZCWK3QZ/D5PQ9q7W9Q6C0uWmUXTo5nmcahcc8jSvdf7HsJiMh/gFka/oUOq/CWJW+aE+ x7lC3RHL/2X/41YusNDhT0wDyLZnbUyUmYQ4CfkMPM9X3CAQ/RNbXlLNwNOu3Rwdgcc+Ll +aqWC7aJi7DGC/FO0+aIo5xxntD6Lmgari7wxGdnnCGejHcncN02tbQNJq3pRIIlKAmVwj VixdHsM6qgwAeeBZuvUypEKAt39IrmUhfI02MiWM0sRXRlnBlsafeu7gdRj0XA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713255750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2WrBY3x+WL6IOyRKs2dAf8XzwLM1vW65ySHoOX1blG4=; b=nyDs5l2IrtzuueXMhrtiajAhEo4u1yrCaypki0f/5DNQpV0JvjWIEgMK+MUkIGjlxk+Sya hB5Fss4/Q+kWn0+kW+Ew7GQZhIShwVJlTpKUVfgNr4vO94uDPTpKbZ8a1O3t9StT0B0uSs tE+5eiLHT1MIYpQK4Xk+VTHO8c2QDpk4Hf5CFgHDLt/4VOTKPvMbQY7MKYLvJZ5+x7O6VO rNi/I1KPnP6dp4Mb7r7bwUspR4P7IQM+3M0GRdWIrXBEnjfsEewPZm5hB5zBBGk0h/YQnn S1YCDlgr/ZHUpivre8HJxsCPae8OMPtxQfsnaVsaCpViYLvi4l6TsMqPYH6YNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VJcTy1f9pzbVC; Tue, 16 Apr 2024 08:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43G8MUKs032047; Tue, 16 Apr 2024 08:22:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43G8MUA3032044; Tue, 16 Apr 2024 08:22:30 GMT (envelope-from git) Date: Tue, 16 Apr 2024 08:22:30 GMT Message-Id: <202404160822.43G8MUA3032044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 02a2005a5a2d - main - stress2: Add new unionfs test scenarios List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02a2005a5a2d0a2a6e0920ee13f6d63dca55e8e0 Auto-Submitted: auto-generated The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=02a2005a5a2d0a2a6e0920ee13f6d63dca55e8e0 commit 02a2005a5a2d0a2a6e0920ee13f6d63dca55e8e0 Author: Peter Holm AuthorDate: 2024-04-16 08:21:14 +0000 Commit: Peter Holm CommitDate: 2024-04-16 08:21:14 +0000 stress2: Add new unionfs test scenarios --- tools/test/stress2/misc/unionfs15.sh | 86 ++++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/unionfs16.sh | 65 +++++++++++++++++++++++++++ tools/test/stress2/misc/unionfs17.sh | 73 ++++++++++++++++++++++++++++++ tools/test/stress2/misc/unionfs18.sh | 73 ++++++++++++++++++++++++++++++ 4 files changed, 297 insertions(+) diff --git a/tools/test/stress2/misc/unionfs15.sh b/tools/test/stress2/misc/unionfs15.sh new file mode 100755 index 000000000000..87cea7c0b15d --- /dev/null +++ b/tools/test/stress2/misc/unionfs15.sh @@ -0,0 +1,86 @@ +#!/bin/sh + +# +# Copyright (c) 2024 Peter Holm +# +# SPDX-License-Identifier: BSD-2-Clause +# + +# O_PATH test scenario. Variation of nullfs29.sh + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +md1=$mdstart +md2=$((md1 + 1)) +mp1=/mnt$md1 +mp2=/mnt$md2 +mkdir -p $mp1 $mp2 +set -e +for i in $mp1 $mp2; do + mount | grep -q "on $i " && umount -f $i +done +for i in $md1 $md2; do + mdconfig -l | grep -q md$i && mdconfig -d -u $i +done + +mdconfig -a -t swap -s 2g -u $md1 +mdconfig -a -t swap -s 2g -u $md2 +newfs $newfs_flags -n md$md1 > /dev/null +newfs $newfs_flags -n md$md2 > /dev/null +mount /dev/md$md1 $mp1 +mount /dev/md$md2 $mp2 +mount -t unionfs -o noatime $mp1 $mp2 +set +e + +cat > /tmp/unionfs15.c < +#include +#include +#include +#include +#include +#include + +int +main(void) { + int new_dir, new_file, ret; + struct stat sb; + char *dir = "test2"; + char *path= "test2/what2"; + + if (mkdir(dir, 0755) == -1) + err(1, "mkdir(test2)"); + new_dir = openat(AT_FDCWD, dir, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_PATH, 0700); + if (new_dir == -1) + err(1, "openat(%s)", dir); + + ret = fstatat(new_dir, "what2", &sb, AT_SYMLINK_NOFOLLOW); + if (ret == 0) + errx(1, "Expected fstatat() to fail"); + if (ret == -1 && errno != ENOENT) + err(1, "fstatat(%s)", dir); + + close(new_dir); + new_file = openat(AT_FDCWD, path, O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC, 0644); + if (new_file== -1) + err(1, "openat(%s)", path); +} + +EOF +mycc -o /tmp/unionfs15 -Wall -Wextra -O2 /tmp/unionfs15.c || exit 1 +cd $mp2 +/tmp/unionfs15; s=$? +cd $here +umount $mp2 + +while mount | grep -Eq "on $mp2 .*unionfs"; do + umount $mp2 && break + sleep 5 +done +umount $mp2 +umount $mp1 +mdconfig -d -u $md2 +mdconfig -d -u $md1 +rm -f /tmp/unionfs15.c /tmp/unionfs15 +exit $s diff --git a/tools/test/stress2/misc/unionfs16.sh b/tools/test/stress2/misc/unionfs16.sh new file mode 100755 index 000000000000..c1c65f7d8313 --- /dev/null +++ b/tools/test/stress2/misc/unionfs16.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +# +# Copyright (c) 2024 Peter Holm +# +# SPDX-License-Identifier: BSD-2-Clause +# + +# No problems seen with this test scenario + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +[ -d /usr/src/tools/test/stress2 ] || exit 0 +prog=$(basename "$0" .sh) +log=/tmp/$prog.log +md1=$mdstart +md2=$((md1 + 1)) +mp1=/mnt$md1 +mp2=/mnt$md2 +s=0 + +mkdir -p $mp1 $mp2 +set -e +for i in $mp1 $mp2; do + mount | grep -q "on $i " && umount -f $i +done +for i in $md1 $md2; do + mdconfig -l | grep -q md$i && mdconfig -d -u $i +done + +mdconfig -a -t swap -s 3g -u $md1 +mdconfig -a -t swap -s 3g -u $md2 +newfs $newfs_flags -n md$md1 > /dev/null +newfs $newfs_flags -n md$md2 > /dev/null +mount /dev/md$md1 $mp1 +mount /dev/md$md2 $mp2 +(cd $mp1; cp -a /usr/src/tools/test/stress2 .) +(cd $mp2; cp -a /usr/src/tools/test/stress2 .) +rm $mp1/stress2/testcases/run/run +rm $mp2/stress2/testcases/swap/swap +mount -u -o ro $mp1 +mount -t unionfs -o below $mp1 $mp2 +rm $mp2/stress2/testcases/mkdir/mkdir +chmod 777 $mp2 +set +e + +(cd $mp2/stress2; make > /dev/null 2>&1) +export RUNDIR=$mp2/stressX +export runRUNTIME=1m +su $testuser -c "cd $mp2/stress2; ./run.sh vfs.cfg" > /dev/null 2>&1 +umount $mp2 + +while mount | grep -Eq "unionfs.* on $mp2 "; do + umount $mp2 && break + sleep 5 +done +fsck_ffs -fy /dev/md$md2 > $log 2>&1 +grep -Eq "WAS MODIFIED" $log && { cat $log; s=1; } +umount $mp2 +umount $mp1 +mdconfig -d -u $md1 +mdconfig -d -u $md2 +rm -f $log +exit $s diff --git a/tools/test/stress2/misc/unionfs17.sh b/tools/test/stress2/misc/unionfs17.sh new file mode 100755 index 000000000000..bcb6d242187b --- /dev/null +++ b/tools/test/stress2/misc/unionfs17.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# +# Copyright (c) 2024 Peter Holm +# +# SPDX-License-Identifier: BSD-2-Clause +# + +# unionfs(8) test +# Variation of unionfs7.sh, but with tmpfs + +# "mkdir: rmdir(d17) Directory not empty" seen. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +mp1=/mnt$mdstart +mp2=/mnt$((mdstart + 1)) +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 + +mount -t unionfs -o noatime $mp1 $mp2 +set +e +export 'INODES=100000' + +export CTRLDIR=$mp2/stressX.control +export INCARNATIONS=10 +export LOAD=80 +export RUNDIR=$mp2/stressX +export runRUNTIME=5m +export rwLOAD=80 +export symlinkLOAD=80 + +export TESTPROGS=" +testcases/lockf2/lockf2 +testcases/symlink/symlink +testcases/openat/openat +testcases/rw/rw +testcases/fts/fts +testcases/link/link +testcases/lockf/lockf +testcases/creat/creat +testcases/mkdir/mkdir +testcases/rename/rename +testcases/mkfifo/mkfifo +testcases/dirnprename/dirnprename +testcases/dirrename/dirrename +testcases/swap/swap +" + +cp -r ../../stress2 $mp2 +export TESTPROGS=`echo $TESTPROGS | sed 's/\n/ /g'` + +set +e +chmod 777 $mp2 +su $testuser -c \ + "(cd $mp2/stress2; ./testcases/run/run $TESTPROGS)" + +while mount | grep -Eq "on $mp2 .*unionfs"; do + umount $mp2 && 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 diff --git a/tools/test/stress2/misc/unionfs18.sh b/tools/test/stress2/misc/unionfs18.sh new file mode 100755 index 000000000000..e772a67a07fb --- /dev/null +++ b/tools/test/stress2/misc/unionfs18.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# +# Copyright (c) 2024 Peter Holm +# +# SPDX-License-Identifier: BSD-2-Clause +# + +# Simple unionfs(8) + tmpfs test + +# "rmdir: d2: Directory not empty" seen. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +mp1=/mnt$mdstart +mp2=/mnt$((mdstart + 1)) +mkdir -p $mp1 $mp2 +set -e +for i in $mp1 $mp2; do + mount | grep -q "on $i " && umount -f $i +done + +md1=$mdstart +md2=$((md1 + 1)) +mp1=/mnt$md1 +mp2=/mnt$md2 +mkdir -p $mp1 $mp2 +for i in $mp1 $mp2; do + mount | grep -q "on $i " && umount -f $i +done + +if [ $# -eq 0 ]; then + echo "tmpfs version" + mount -o size=4g -t tmpfs dummy $mp1 + mount -o size=4g -t tmpfs dummy $mp2 +else + echo "UFS version" + for i in $md1 $md2; do + mdconfig -l | grep -q md$i && mdconfig -d -u $i + done + mdconfig -a -t swap -s 4g -u $md1 + mdconfig -a -t swap -s 4g -u $md2 + newfs $newfs_flags -n md$md1 > /dev/null + newfs $newfs_flags -n md$md2 > /dev/null + mount /dev/md$md1 $mp1 + mount /dev/md$md2 $mp2 +fi + +mount -t unionfs -o noatime $mp1 $mp2 +set +e + +N=3 # Tree depth +here=`pwd` +cd $mp2 +mkdir dir; cd dir +for j in `seq 1 $N`; do + mkdir d$j && cd d$j +done +for j in `seq $N 1`; do + cd .. && rmdir d$j +done +cd .. +rmdir dir || { s=1; find dir -ls; } +cd $here + +while mount | grep -Eq "on $mp2 .*unionfs"; do + umount $mp2 && break + sleep 5 +done +umount $mp2 +umount $mp1 +exit $s