From nobody Mon Nov 18 09:47:20 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 4XsN882shCz5cdPM; Mon, 18 Nov 2024 09:47:20 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XsN882PtYz43FZ; Mon, 18 Nov 2024 09:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731923240; 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=+IkqtU6oLJA8ZRANO4O6hR3WX6FmpH6zZSoEQPMYy/E=; b=XjhNHwPyrwepjkxSaf4DZGfh5GxW7em8Jq4Dh6d7tM+danTUq8znPhZoFTfbwWes/jrilQ Zm0R3xy7E1ZrXK/YBTXGpiaOdUOaMRSOjM0dkNv8beClEFetTMbwqfLEB6Dfv/JwrAZiph LDDII/SuJMysBxANPtg9uFchFEyIPTAlWHjVFG/UPJDyIyHKBww8gykApHfFeuQx5q9JQ9 GF3oWqMtsaqw272994qNH0tTCWA7FKPA2QNfpFEutjcgI1aWbJ9nBH30B55Xv1dXDVIh15 KFLbVL4PrVj7g4MJ0gIgHDBq8hoBob+ahfIjhEbdc2lMdR/s1AC5ncg1+Ji5MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731923240; 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=+IkqtU6oLJA8ZRANO4O6hR3WX6FmpH6zZSoEQPMYy/E=; b=FrNAR+jgmor0iTMUxGoyhbg8pzAy8eti2yk/hBD/pT/nME6o8PQ4kdP/gH6ZOdWnMmWcMk 6VKdajk5BJcrwdNoDP5vg/Z5MTEABLIyevwFbBZglruEHhstKaYoRzEx090Kca+OrZOICO Rm7Vs3oVlPQbCBZDZf6fDJSAjmTlOKovSzSChKKpl+hnpEhvwq2Kxmm05chM408JMCrid/ sczylwMpufz8s9K1P66glyfxjtzcc6OFUqjmHnTDQxyj4bX/Gn9gLN2DFVeBXmJLF7BBae 6wzgEXyzEEh5ohtDcOKPkykt4BmXVT4m++AdEaKuEFwdgvEnK60oyDU1512twg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731923240; a=rsa-sha256; cv=none; b=KsD5Gb4SuVePf6NxlxKEAFi8h2Cq04Nd52uDFOkvr2vahqN88pWWgZ+AyFwD3g+JuY9Ofw KegY9BAHuXNmNrdewMpv4O1idjShLIpaoLTWrmGe391/W7PCUiwXxM+u/hqnJQm4BbFzty zgNGGUoc/+mYfdgL47DFrLFnTPzXRJf+kkHHM2IJzaD03uvR0ToRUfHiqbfQQ9F/L82i5d PdXEoSvyuzjzbRRdj7nhVYO0QMwt1VcY8N1ZlpyL7u+9NokSrFf/tJBAePQSMBE+/jpLPy z5CeTm21ME+ikKTUcX8ewANBr8HP2VLShgj/SA9eXr/4dy+QYw1JnZQuYqay1g== 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 4XsN8821BKzbTR; Mon, 18 Nov 2024 09:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AI9lKRm027854; Mon, 18 Nov 2024 09:47:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AI9lKZU027851; Mon, 18 Nov 2024 09:47:20 GMT (envelope-from git) Date: Mon, 18 Nov 2024 09:47:20 GMT Message-Id: <202411180947.4AI9lKZU027851@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: 43778a593f92 - main - stress2: Added zfs 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: 43778a593f92dc09cedee69b47b6486dd579900b Auto-Submitted: auto-generated The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=43778a593f92dc09cedee69b47b6486dd579900b commit 43778a593f92dc09cedee69b47b6486dd579900b Author: Peter Holm AuthorDate: 2024-11-18 09:46:28 +0000 Commit: Peter Holm CommitDate: 2024-11-18 09:46:28 +0000 stress2: Added zfs test scenarios --- tools/test/stress2/misc/zfs15.sh | 88 ++++++++++++++++++++++++++++++++ tools/test/stress2/misc/zfs16.sh | 105 +++++++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/zfs17.sh | 74 +++++++++++++++++++++++++++ tools/test/stress2/misc/zfs19.sh | 72 +++++++++++++++++++++++++++ 4 files changed, 339 insertions(+) diff --git a/tools/test/stress2/misc/zfs15.sh b/tools/test/stress2/misc/zfs15.sh new file mode 100755 index 000000000000..b40474507517 --- /dev/null +++ b/tools/test/stress2/misc/zfs15.sh @@ -0,0 +1,88 @@ +#!/bin/sh + +# Test scenario suggestion by: markj@ + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +kldstat -v | grep -q zfs.ko || { kldload zfs.ko; loaded=1; } || + exit 0 + +. ../default.cfg + +here=`pwd` +level=`jot -r 1 1 3` # Redundancy levels +mp1=/stress2_tank/test +s=0 +u1=$mdstart +u2=$((u1 + 1)) +u3=$((u1 + 2)) +u4=$((u1 + 3)) +u5=$((u1 + 4)) + +set -e +mdconfig -l | grep -q md$u1 && mdconfig -d -u $u1 +mdconfig -l | grep -q md$u2 && mdconfig -d -u $u2 +mdconfig -l | grep -q md$u3 && mdconfig -d -u $u3 +mdconfig -l | grep -q md$u4 && mdconfig -d -u $u4 +mdconfig -l | grep -q md$u5 && mdconfig -d -u $u5 + +mdconfig -s 512m -u $u1 +mdconfig -s 512m -u $u2 +mdconfig -s 512m -u $u3 +mdconfig -s 512m -u $u4 +mdconfig -s 512m -u $u5 + +zpool list | egrep -q "^stress2_tank" && zpool destroy stress2_tank +[ -d /stress2_tank ] && rm -rf /stress2_tank +zpool create stress2_tank raidz$level md$u1 md$u2 md$u3 md$u4 +zfs create stress2_tank/test +set +e + +export RUNDIR=/stress2_tank/test/stressX +export runRUNTIME=5m +export LOAD=80 +export symlinkLOAD=80 +export rwLOAD=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 +" + +(cd ..; ./testcases/run/run $TESTPROGS > /dev/null 2>&1) & + +sleep 60 +echo "zpool attach stress2_tank raidz$level-0 md$u5" +zpool attach stress2_tank raidz$level-0 md$u5 +sleep 30 +zfs snapshot stress2_tank/test@1 +wait + +while zpool status | grep -q "in progress"; do + sleep 5 +done +zpool scrub stress2_tank +zpool status | grep -q "errors: No known data errors" || + { zpool status; s=1; } + +zfs umount stress2_tank/test +zfs destroy -r stress2_tank +zpool destroy stress2_tank + +mdconfig -d -u $u1 +mdconfig -d -u $u2 +mdconfig -d -u $u3 +mdconfig -d -u $u4 +mdconfig -d -u $u5 +[ -n "$loaded" ] && kldunload zfs.ko +exit $s diff --git a/tools/test/stress2/misc/zfs16.sh b/tools/test/stress2/misc/zfs16.sh new file mode 100755 index 000000000000..258bf9ea4799 --- /dev/null +++ b/tools/test/stress2/misc/zfs16.sh @@ -0,0 +1,105 @@ +#!/bin/sh + +# No problems seen + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +kldstat -v | grep -q zfs.ko || { kldload zfs.ko; loaded=1; } || + exit 0 + +. ../default.cfg + +here=`pwd` +cd /tmp +sed '1,/^EOF/d' < $here/datamove.sh > zfs16.c +mycc -o zfs16 -Wall -O0 -g zfs16.c || exit 1 +rm -f zfs16.c + +mp1=/stress2_tank/test +u1=$mdstart +u2=$((u1 + 1)) + +set -eu +mdconfig -l | grep -q md$u1 && mdconfig -d -u $u1 +mdconfig -l | grep -q md$u2 && mdconfig -d -u $u2 + +mdconfig -s 2g -u $u1 +mdconfig -s 2g -u $u2 + +zpool list | egrep -q "^stress2_tank" && zpool destroy stress2_tank +[ -d /stress2_tank ] && rm -rf /stress2_tank +zpool create stress2_tank md$u1 md$u2 +zfs create stress2_tank/test +set +e + +(cd $here/../testcases/swap; ./swap -t 2m -i 20 -l 100 -h > /dev/null) & +sleep 2 +cd $mp1 +while pgrep -q swap; do + /tmp/zfs16; s=$? + rm -f /stress2_tank/test/* +done +cd $here +while pkill swap; do sleep 1; done +wait + +zfs umount stress2_tank/test +zfs destroy -r stress2_tank +zpool destroy stress2_tank +mdconfig -d -u $u1 +mdconfig -d -u $u2 +rm -f /tmp/zfs16 +set +u +[ $loaded ] && kldunload zfs.ko +exit $s +EOF +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SIZ (500UL * 1024 * 1024) + +int +main(int argc __unused, char *argv[]) +{ + off_t hole; + size_t len; + int fd; + char *p, *path; + + len = SIZ; + + path = argv[1]; + if ((fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0622)) == -1) + err(1,"open()"); + if (ftruncate(fd, len) == -1) + err(1, "ftruncate"); + if ((p = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == + MAP_FAILED) { + if (errno == ENOMEM) + return (1); + err(1, "mmap(1)"); + } + p[1 * 1024] = 1; + p[2 * 1024] = 1; + p[4 * 1024] = 1; + + if (msync(p, len, MS_SYNC | MS_INVALIDATE) == -1) + err(1, "msync()"); + + if ((hole = lseek(fd, 0, SEEK_HOLE)) == -1) + err(1, "lseek(SEEK_HOLE)"); + if (hole != SIZ) + printf("--> hole = %jd, file size=%jd\n", + (intmax_t)hole, (intmax_t)SIZ); + close(fd); + + return (hole == SIZ ? 0 : 1); +} diff --git a/tools/test/stress2/misc/zfs17.sh b/tools/test/stress2/misc/zfs17.sh new file mode 100755 index 000000000000..d20e39765afa --- /dev/null +++ b/tools/test/stress2/misc/zfs17.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +# +# Copyright (c) 2024 Peter Holm +# +# SPDX-License-Identifier: BSD-2-Clause +# + +# Copy from nullfs over zfs to nullfs over ufs +# Test scenario description by: mjguzik + +# Page fault seen: +# https://people.freebsd.org/~pho/stress/log/log0498.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ `sysctl -n kern.kstack_pages` -lt 4 ] && exit 0 + +. ../default.cfg + +set -u +kldstat -v | grep -q zfs.ko || { kldload zfs.ko || + exit 0; loaded=1; } + +u1=$mdstart +u2=$((u1 + 1)) +u3=$((u2 + 1)) +mp0=/stress2_tank/test # zfs mount +mp1=$mntpoint # nullfs of zfs +mp2=$mntpoint$mdstart # ufs +mp3=$mntpoint$((mdstart + 1)) # nullfs of ufs +mkdir -p $mp2 $mp3 + +mdconfig -l | grep -q md$u1 && mdconfig -d -u $u1 +mdconfig -l | grep -q md$u2 && mdconfig -d -u $u2 + +mdconfig -s 2g -u $u1 +mdconfig -s 2g -u $u2 + +zpool list | egrep -q "^stress2_tank" && zpool destroy stress2_tank +[ -d /stress2_tank ] && rm -rf /stress2_tank +zpool create stress2_tank raidz md$u1 md$u2 +zfs create ${mp0#/} + +mount | grep -q $mp1 && umount -f $mp1 +mount -t nullfs $mp0 $mp1 + +mdconfig -a -t swap -s 1g -u $u3 +newfs $newfs_flags /dev/md$u3 > /dev/null +mount /dev/md$u3 $mp2 +mount -t nullfs $mp2 $mp3 + +dd if=/dev/zero of=$diskimage bs=1m count=50 status=none +cp $diskimage $mp1 +cp $mp1/diskimage $mp3 +rm -f $diskimage + +umount $mp3 +umount $mp2 +mdconfig -d -u $u3 + +while mount | grep -q "on $mntpoint "; do + umount $mntpoint && break + sleep 1 +done + +zfs umount ${mp0#/} +zfs destroy -r stress2_tank +zpool destroy stress2_tank + +mdconfig -d -u $u2 +mdconfig -d -u $u1 +set +u +[ -n "$loaded" ] && kldunload zfs.ko +exit 0 diff --git a/tools/test/stress2/misc/zfs19.sh b/tools/test/stress2/misc/zfs19.sh new file mode 100755 index 000000000000..a3bb19c8be07 --- /dev/null +++ b/tools/test/stress2/misc/zfs19.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# +# Copyright (c) 2024 Peter Holm +# +# SPDX-License-Identifier: BSD-2-Clause +# + +# Hunt for "vm_fault: pager read error, pid 99058 (mmap)" + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +kldstat -v | grep -q zfs.ko || { kldload zfs.ko; loaded=1; } || + exit 0 + +. ../default.cfg + +prog=$(basename "$0" .sh) +here=`pwd` +log=/tmp/$prog.log +mp1=/stress2_tank/test +u1=$mdstart +u2=$((u1 + 1)) + +set -e +mdconfig -l | grep -q md$u1 && mdconfig -d -u $u1 +mdconfig -l | grep -q md$u2 && mdconfig -d -u $u2 + +mdconfig -s 2g -u $u1 +mdconfig -s 2g -u $u2 + +zpool list | egrep -q "^stress2_tank" && zpool destroy stress2_tank +[ -d /stress2_tank ] && rm -rf /stress2_tank +zpool create stress2_tank md$u1 md$u2 +zfs create stress2_tank/test +set +e + +export RUNDIR=/stress2_tank/test/stressX +export runRUNTIME=2m +export LOAD=70 +export mmapLOAD=100 +export TESTPROGS="testcases/mmap/mmap testcases/swap/swap" + +(cd ..; ./testcases/run/run $TESTPROGS > /dev/null 2>&1) & rpid=$! +sleep 5 + +tail -F -n 0 /var/log/messages > $log & lpid=$! + +start=`date +%s` +while [ $((`date +%s` - start)) -lt 120 ]; do + zfs umount -f stress2_tank/test && + zfs mount stress2_tank/test + sleep 5 + zfs list | grep -q /stress2_tank/test || break + pgrep -q mmap || break +done +pkill run swap mmap +while pgrep -q swap; do pkill swap; done +wait $rpid + +zfs umount stress2_tank/test +zfs destroy -r stress2_tank +zpool destroy stress2_tank + +mdconfig -d -u $u1 +mdconfig -d -u $u2 +[ -n "$loaded" ] && kldunload zfs.ko + +kill $lpid && wait $lpid +grep -m 1 "pager read error" $log && s=1 || s=0 +rm $log +s=0 # This is an expected behavior for zfs +exit $s