From nobody Mon Nov 18 09:40:52 2024 X-Original-To: dev-commits-src-all@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 4XsN0h3Rbsz5ccrn; Mon, 18 Nov 2024 09:40:52 +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 4XsN0h0x19z42Gj; Mon, 18 Nov 2024 09:40:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731922852; 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=FzEiGe72leN6YX8/JSAT5iAE6uB5JVpEY0KrsPedhXQ=; b=PBWkeqjI9h+8fU1FeYF/07DJoecFbcnUmt6vIDF4TOtQtldKZmoqovUxirVHu8W8ZijZAI ieoAyAg+wCmMp7sC/vaU6paeSk6kzZ57M+FkvNVjc/dZs+HCyrAmOgl2K0KJEkY4Jcts5e NjTb+fDpz9M3BZs8+RL9O6OTJBbQWiBPUd6MovYiGMEhvfOVgFPxW7ALyzxsjzIl1UvMo6 juPLDo4k+1kjH6zhao4W+O8BT+fJ1KNtIuJGGEolo06siFuNTgjBorUhs2U3/R8yGbtRpB kNLDmh8mySTchhyHewVa7KZnlJCd7uLID3kenTOX2WmXog0oEWKrBn/cJuoouA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731922852; 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=FzEiGe72leN6YX8/JSAT5iAE6uB5JVpEY0KrsPedhXQ=; b=JStnWc+81Vf9ydFJq7XsF50eOju6nv4Cm0294swi/dAKSqoEd25S4l+/G04v91hCsAUh3x 1XplwfM11EZ17Xk9kbx+Mb5Za9/v255/BCSxU5t43ObdUCiewuzWaJnAP5bU5VsW7y6zWF B9ZmT2VpTc3fZsjyWK+JClFUo0UhliEA2ZYKcX3vDjt0jo9JUBL+qzdLurCiOn7p0PLsm5 npq0TMaq30n/6YrjrlTcBuxdIRx1WQuA1u/rw9W6tgZk/4y7PbjdD0bRahiTz8Dn8prcFQ oJ2qD13TFAh8W3B4bsQ0GGHB+wOLMuR1jm+1qAyHqANsfJT9EktIwoFRKoZ7JA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731922852; a=rsa-sha256; cv=none; b=VMsqN6KVzeIZooR+BHwa3OnMDIXHqrtvN64g/to2bieO27gS8vJVdgZ6mo3ekwJVY19TqC 2Zpp37mYbNqOCxPhMP30yDYFee+6L0mIhY9N+/xz8XPUPMvmMfJawFFIUB0rqy2krU7of7 EAjsmOXn6IymEjFyRLnrZ2wkOr+Gbki+P7MplJAhKyLsp6eeWI2bd/GEYfQvoDFvUwW1jl 0UuTc1wLorSEDXJXkIbwrS5+CdldzZNPkouxFkDpEa++IsaaN7syWPaTUFg9NmEZIfa9Ee DuV0h2N/EsO/Ww9GPXbQQaaGo+/RyjTnljLXBryxl6p6qaOx+k04Zm6LeVXIQQ== 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 4XsN0h0Xh2zZyD; Mon, 18 Nov 2024 09:40:52 +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 4AI9eqAS020681; Mon, 18 Nov 2024 09:40:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AI9eqWg020678; Mon, 18 Nov 2024 09:40:52 GMT (envelope-from git) Date: Mon, 18 Nov 2024 09:40:52 GMT Message-Id: <202411180940.4AI9eqWg020678@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: 55aa53fbf2bb - main - stress2: Added a zfs regression test scenario List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 55aa53fbf2bbeb7c032eae1a3767e043390a28da Auto-Submitted: auto-generated The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=55aa53fbf2bbeb7c032eae1a3767e043390a28da commit 55aa53fbf2bbeb7c032eae1a3767e043390a28da Author: Peter Holm AuthorDate: 2024-11-18 09:40:16 +0000 Commit: Peter Holm CommitDate: 2024-11-18 09:40:16 +0000 stress2: Added a zfs regression test scenario --- tools/test/stress2/misc/zfs18.sh | 134 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/tools/test/stress2/misc/zfs18.sh b/tools/test/stress2/misc/zfs18.sh new file mode 100755 index 000000000000..fb4f301f43c9 --- /dev/null +++ b/tools/test/stress2/misc/zfs18.sh @@ -0,0 +1,134 @@ +#!/bin/sh + +# File corruption scenario. +# Test program obtained from Kyle Evans + +# "panic: VERIFY3(rc->rc_count == number) failed (4849664 == 0)" seen. + +# Page fault seen: +# https://people.freebsd.org/~pho/stress/log/log0560.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ `sysctl -n kern.kstack_pages` -lt 4 ] && exit 0 + +. ../default.cfg + +prog=$(basename "$0" .sh) +cat > /tmp/$prog.c < +#include + +#include +#include +#include +#include +#include + +//#define FILE "2" +#define FILE "file" + +int +main(void) +{ + struct stat sb; + ssize_t wsz; + size_t bufsz; + void *buf, *obuf; + int mfd, fd; + int done = 0; + + mfd = open(FILE, O_RDONLY); + assert(mfd >= 0); + + assert(fstat(mfd, &sb) == 0); + bufsz = sb.st_size; + buf = obuf = mmap(NULL, bufsz, PROT_READ, MAP_SHARED, mfd, 0); + assert(buf != MAP_FAILED); + + /* O_RDWR */ + fd = open(FILE, O_RDWR); + if (fd < 0) + err(1, "open"); + assert(fd >= 0); + +again: + while (bufsz > 0) { + wsz = write(fd, buf, bufsz); + if (wsz < 0) + err(1, "write"); + else if (wsz == 0) + fprintf(stderr, "Huh?\n"); + bufsz -= wsz; + buf += wsz; + } + + bufsz = sb.st_size; + buf = obuf; + + if (++done < 2) + goto again; + + close(fd); + munmap(obuf, sb.st_size); + close(mfd); + return (0); +} +EOF +mycc -o /tmp/$prog -Wall -Wextra -O0 /tmp/$prog.c || exit 1 +set -u +kldstat -v | grep -q zfs.ko || { kldload zfs.ko || + exit 0; loaded=1; } + +u1=$mdstart +u2=$((u1 + 1)) +mp0=/stress2_tank/test # zfs mount + +mdconfig -l | grep -q md$u1 && mdconfig -d -u $u1 +mdconfig -l | grep -q md$u2 && mdconfig -d -u $u2 + +mdconfig -s 4g -u $u1 +mdconfig -s 4g -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#/} + +here=`pwd` +cd /stress2_tank +# Optimized file creation: +#jot -b 'A' -s '' 875998989 > file +dd if=/dev/random of=file bs=1m count=$(((875998990/1024/1024)+1)) status=none +truncate -s 875998990 file +cat file file > file.post +mv file file.orig + +counter=1 +s=0 +start=`date +%s` +while [ $((`date +%s` - start)) -lt 300 ]; do + cp file.orig file + /tmp/$prog + if ! cmp file file.post; then + echo "Iteration #$counter" + od -t x8 file | head -1000 > /tmp/$prog.file1 + od -t x8 file.post | head -1000 > /tmp/$prog.file2 + diff /tmp/$prog.file1 /tmp/$prog.file2 | head -15 + rm /tmp/$prog.file1 /tmp/$prog.file2 + s=1 + break + fi + counter=$((counter + 1)) +done +cd $here + +zfs umount ${mp0#/} +zfs destroy -r stress2_tank +zpool destroy stress2_tank + +mdconfig -d -u $u2 +mdconfig -d -u $u1 +set +u +[ $loaded ] && kldunload zfs.ko +rm /tmp/$prog /tmp/$prog.c +exit $s