From owner-svn-src-user@freebsd.org  Tue Apr 11 12:38:43 2017
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60D93D39DD1
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Tue, 11 Apr 2017 12:38:43 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 38D6FD47;
 Tue, 11 Apr 2017 12:38:43 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3BCcgai030360;
 Tue, 11 Apr 2017 12:38:42 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3BCcgkL030359;
 Tue, 11 Apr 2017 12:38:42 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201704111238.v3BCcgkL030359@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Tue, 11 Apr 2017 12:38:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r316700 - user/pho/stress2/misc
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Apr 2017 12:38:43 -0000

Author: pho
Date: Tue Apr 11 12:38:42 2017
New Revision: 316700
URL: https://svnweb.freebsd.org/changeset/base/316700

Log:
  Make this test run on i386 by limiting RLIMIT_MEMLOCK as suggested by
  markj@.
  Remove further VM pressure from test, as this proved unnecessary.
  Changes tested on both i386 and amd64, before and after the r316689 fix of
  the vm_fault_copy_entry() panic seen.
  
  Suggested by:	 markj
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/mmap18.sh

Modified: user/pho/stress2/misc/mmap18.sh
==============================================================================
--- user/pho/stress2/misc/mmap18.sh	Tue Apr 11 08:56:18 2017	(r316699)
+++ user/pho/stress2/misc/mmap18.sh	Tue Apr 11 12:38:42 2017	(r316700)
@@ -30,7 +30,10 @@
 
 # Copy of mmap10.sh with core dump disabled.
 # http://people.freebsd.org/~pho/stress/log/kostik711.txt
+
+# panic: vm_fault_copy_entry: main object missing page
 # http://people.freebsd.org/~pho/stress/log/mmap18.txt
+# Fixed by: r316689
 
 [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
 
@@ -42,16 +45,14 @@ sed '1,/^EOF/d' < $here/$0 > mmap18.c
 mycc -o mmap18 -Wall -Wextra -O2 mmap18.c -lpthread || exit 1
 rm -f mmap18.c
 
-daemon sh -c "(cd $here/../testcases/swap; ./swap -t 2m -i 20 -k)"
-rnd=`od -An -N1 -t u1 /dev/random | sed 's/ //g'`
-sleep $((rnd % 10))
-for i in `jot 2`; do
-	/tmp/mmap18
+s=0
+wire=$((`sysctl -n vm.max_wired` - `sysctl -n vm.stats.vm.v_wire_count`))
+for i in `jot 5`; do
+	/tmp/mmap18 `sysctl -n vm.max_wired` || s=1
 done
-killall -q swap
 
 rm -f /tmp/mmap18 /tmp/mmap18.core
-exit 0
+exit $s
 EOF
 #include <sys/types.h>
 #include <sys/mman.h>
@@ -77,10 +78,10 @@ EOF
 #define N (128 * 1024 / (int)sizeof(u_int32_t))
 #define PARALLEL 50
 
-u_int32_t r[N];
-void *p;
+static u_int32_t r[N];
+static void *p;
 
-unsigned long
+static unsigned long
 makearg(void)
 {
 	unsigned long val;
@@ -102,10 +103,10 @@ makearg(void)
 	}
 #endif
 
-	return(val);
+	return (val);
 }
 
-void *
+static void *
 makeptr(void)
 {
 	unsigned long val;
@@ -119,7 +120,7 @@ makeptr(void)
 	return ((void *)val);
 }
 
-void *
+static void *
 tmmap(void *arg __unused)
 {
 	size_t len;
@@ -138,8 +139,8 @@ tmmap(void *arg __unused)
 			munmap(p, len);
 		}
 
-		if ((p = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_ANON, -1,
-		    0)) != MAP_FAILED) {
+		if ((p = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_ANON,
+		    -1, 0)) != MAP_FAILED) {
 			usleep(100);
 			munmap(p, len);
 		}
@@ -149,7 +150,7 @@ tmmap(void *arg __unused)
 	return (NULL);
 }
 
-void *
+static void *
 tmlock(void *arg __unused)
 {
 	int i, n;
@@ -167,16 +168,16 @@ tmlock(void *arg __unused)
 				n++;
 	}
 	if (n < 10)
-		fprintf(stderr, "Note: tmlock() only succeeded %d times.\n",
-		    n);
+		fprintf(stderr, "Note: tmlock() only succeeded %d "
+		    "times.\n", n);
 
 	return (NULL);
 }
 
-void *
+static void *
 tmprotect(void *arg __unused)
 {
-	const void *addr;
+	void *addr;
 	size_t len;
 	int i, n, prot;
 
@@ -191,13 +192,13 @@ tmprotect(void *arg __unused)
 		usleep(1000);
 	}
 	if (n < 10)
-		fprintf(stderr, "Note: tmprotect() only succeeded %d times.\n",
-		    n);
+		fprintf(stderr, "Note: tmprotect() only succeeded %d "
+		    "times.\n", n);
 
 	return (NULL);
 }
 
-void *
+static void *
 tmlockall(void *arg __unused)
 {
 	int flags, i, n;
@@ -213,13 +214,13 @@ tmlockall(void *arg __unused)
 		usleep(1000);
 	}
 	if (n < 10)
-		fprintf(stderr, "Note: tmlockall() only succeeded %d times.\n",
-		    n);
+		fprintf(stderr, "Note: tmlockall() only succeeded %d "
+		    "times.\n", n);
 
 	return (NULL);
 }
 
-void
+static void
 test(void)
 {
 	pthread_t tid[4];
@@ -249,15 +250,32 @@ test(void)
 }
 
 int
-main(void)
+main(int argc, char *argv[])
 {
 	struct rlimit rl;
+	rlim_t maxlock;
 	int i, j;
 
+	if (argc != 2) {
+		fprintf(stderr, "Usage:%s <max pages to lock.>\n", argv[0]);
+		exit(1);
+	}
 	rl.rlim_max = rl.rlim_cur = 0;
 	if (setrlimit(RLIMIT_CORE, &rl) == -1)
 		warn("setrlimit");
 
+	if (getrlimit(RLIMIT_MEMLOCK, &rl) == -1)
+		warn("getrlimit");
+	maxlock = atol(argv[1]);
+	if (maxlock == 0)
+		errx(1, "Argument is zero");
+	maxlock = (maxlock / 10 * 8) / PARALLEL * PAGE_SIZE;
+	if (maxlock < rl.rlim_cur) {
+		rl.rlim_max = rl.rlim_cur = maxlock;
+		if (setrlimit(RLIMIT_MEMLOCK, &rl) == -1)
+			warn("setrlimit");
+	}
+
 	for (i = 0; i < N; i++)
 		r[i] = arc4random();
 

From owner-svn-src-user@freebsd.org  Thu Apr 13 17:13:10 2017
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3295BD3B4D0
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Thu, 13 Apr 2017 17:13:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id E9EA8845;
 Thu, 13 Apr 2017 17:13:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3DHD96i041528;
 Thu, 13 Apr 2017 17:13:09 GMT (envelope-from gjb@FreeBSD.org)
Received: (from gjb@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3DHD9aL041527;
 Thu, 13 Apr 2017 17:13:09 GMT (envelope-from gjb@FreeBSD.org)
Message-Id: <201704131713.v3DHD9aL041527@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
 using -f
From: Glen Barber <gjb@FreeBSD.org>
Date: Thu, 13 Apr 2017 17:13:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r316773 - user/gjb/thermite
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Apr 2017 17:13:10 -0000

Author: gjb
Date: Thu Apr 13 17:13:08 2017
New Revision: 316773
URL: https://svnweb.freebsd.org/changeset/base/316773

Log:
  Add the template email for ALPHA, BETA, and RC announcements.
  
  Sponsored by:	The FreeBSD Foundation

Added:
  user/gjb/thermite/non-release-template-mail.txt   (contents, props changed)

Added: user/gjb/thermite/non-release-template-mail.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/gjb/thermite/non-release-template-mail.txt	Thu Apr 13 17:13:08 2017	(r316773)
@@ -0,0 +1,170 @@
+# $FreeBSD$
+--- start template ---
+
+%%SBRANCH%% = "stable/%%MAJOR%%
+%%MAJOR%%   = "X" in "X.Y"
+%%MINOR%%   = "Y" in "X.Y"
+%%PREV%%    = "X-1.Y-RELEASE"
+%%VERSION%% = X.Y
+%%BRANCH%%  = BETA1, BETA2, etc.
+%%WHICH%%   = first, second, etc.
+%%WHAT%%    = ALPHA, BETA, RC, etc.
+%%LAST%%    = X.Y-BETAN-1, X.Y-RCN-1
+
+!!!IMPORTANT!!!
+Look for the 'XXX' sections and fill in appropriately.
+
+---- end template ----
+
+To: freebsd-current@FreeBSD.org, freebsd-stable@FreeBSD.org
+Cc: re@FreeBSD.org
+Subject: FreeBSD %%VERSION%%-%%BRANCH%% Now Available
+
+The %%WHICH%% %%WHAT%% build of the %%VERSION%%-RELEASE release cycle is now available.
+
+Installation images are available for:
+
+# XXX # UPDATE THIS WITH REALITY
+o amd64 GENERIC
+o i386 GENERIC
+o powerpc GENERIC
+o powerpc64 GENERIC64
+o sparc64 GENERIC
+o armv6 BEAGLEBONE
+o armv6 CUBOX-HUMMINGBOARD
+o armv6 GUMSTIX
+o armv6 PANDABOARD
+o armv6 RPI-B
+o armv6 WANDBOARD
+# END # UPDATE THIS WITH REALITY
+
+Note regarding arm/armv6 images: For convenience for those without
+console access to the system, a freebsd user with a password of
+freebsd is available by default for ssh(1) access.  Additionally,
+the root user password is set to root, which it is strongly
+recommended to change the password for both users after gaining
+access to the system.
+
+Installer images and memory stick images are available here:
+
+    ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/%%VERSION%%/
+
+The image checksums follow at the end of this e-mail.
+
+If you notice problems you can report them through the Bugzilla PR
+system or on the -stable mailing list.
+
+If you would like to use SVN to do a source based update of an existing
+system, use the "%%SBRANCH%%" branch.
+
+XXX: If BETA1, remove this.  For non-BETA1, fill in the change list.
+A summary of changes since %%LAST%% includes:
+XXX: Insert change list here
+
+A list of changes since %%PREV%% are available on the %%SBRANCH%%
+release notes:
+
+XXX: If -CURRENT, exclude %%MAJOR%%.
+XXX: If in -RC phase, use the second URL.
+
+    https://www.freebsd.org/relnotes/%%MAJOR%%-%%BRANCH%%/relnotes/article.html
+    https://www.freebsd.org/releases/%%VERSION%%R/relnotes.html
+
+Please note, the release notes page is not yet complete, and will be
+updated on an ongoing basis as the %%VERSION%%-RELEASE cycle progresses.
+
+=== Virtual Machine Disk Images ===
+
+VM disk images are available for the amd64 and i386 architectures.
+Disk images may be downloaded from the following URL (or any of the
+FreeBSD FTP mirrors):
+
+    ftp://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/%%VERSION%%-%%BRANCH%%/
+
+The partition layout is:
+
+    ~ 16 kB - freebsd-boot GPT partition type (bootfs GPT label)
+    ~ 1 GB  - freebsd-swap GPT partition type (swapfs GPT label)
+    ~ 20 GB - freebsd-ufs GPT partition type (rootfs GPT label)
+
+The disk images are available in QCOW2, VHD, VMDK, and raw disk image
+formats.  The image download size is approximately 135 MB and 165 MB
+respectively (amd64/i386), decompressing to a 21 GB sparse image.
+
+Note regarding arm64/aarch64 virtual machine images: a modified QEMU EFI
+loader file is needed for qemu-system-aarch64 to be able to boot the
+virtual machine images.  See this page for more information:
+
+    https://wiki.freebsd.org/arm64/QEMU
+
+To boot the VM image, run:
+
+    % qemu-system-aarch64 -m 4096M -cpu cortex-a57 -M virt  \
+	-bios QEMU_EFI.fd -serial telnet::4444,server -nographic \
+	-drive if=none,file=VMDISK,id=hd0 \
+	-device virtio-blk-device,drive=hd0 \
+	-device virtio-net-device,netdev=net0 \
+	-netdev user,id=net0
+
+Be sure to replace "VMDISK" with the path to the virtual machine image.
+
+=== Amazon EC2 AMI Images ===
+
+FreeBSD/amd64 EC2 AMIs are available in the following regions:
+
+XXX: grab the AMI IDs from the thermite.sh log
+
+=== Vagrant Images ===
+
+FreeBSD/amd64 images are available on the Hashicorp Atlas site, and can
+be installed by running:
+
+    % vagrant init freebsd/FreeBSD-%%VERSION%%-%%BRANCH%%
+    % vagrant up
+
+=== Upgrading ===
+
+The freebsd-update(8) utility supports binary upgrades of amd64 and i386
+systems running earlier FreeBSD releases.  Systems running earlier
+FreeBSD releases can upgrade as follows:
+
+	# freebsd-update upgrade -r %%VERSION%%-%%BRANCH%%
+
+During this process, freebsd-update(8) may ask the user to help by
+merging some configuration files or by confirming that the automatically
+performed merging was done correctly.
+
+	# freebsd-update install
+
+The system must be rebooted with the newly installed kernel before
+continuing.
+
+	# shutdown -r now
+
+After rebooting, freebsd-update needs to be run again to install the new
+userland components:
+
+	# freebsd-update install
+
+It is recommended to rebuild and install all applications if possible,
+especially if upgrading from an earlier FreeBSD release, for example,
+FreeBSD 10.x.  Alternatively, the user can install misc/compat10x and
+other compatibility libraries, afterwards the system must be rebooted
+into the new userland:
+
+	# shutdown -r now
+
+Finally, after rebooting, freebsd-update needs to be run again to remove
+stale files:
+
+	# freebsd-update install
+
+== ISO CHECKSUMS ==
+
+XXX: Insert checksums here
+
+== VM IMAGE CHECKSUMS ==
+
+XXX: Insert checksums here
+
+

From owner-svn-src-user@freebsd.org  Thu Apr 13 17:30:34 2017
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id B859CD3BE4E
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Thu, 13 Apr 2017 17:30:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 85CAC64E;
 Thu, 13 Apr 2017 17:30:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3DHUXrJ046210;
 Thu, 13 Apr 2017 17:30:33 GMT (envelope-from gjb@FreeBSD.org)
Received: (from gjb@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3DHUX5g046209;
 Thu, 13 Apr 2017 17:30:33 GMT (envelope-from gjb@FreeBSD.org)
Message-Id: <201704131730.v3DHUX5g046209@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
 using -f
From: Glen Barber <gjb@FreeBSD.org>
Date: Thu, 13 Apr 2017 17:30:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r316775 - user/gjb/thermite
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Apr 2017 17:30:34 -0000

Author: gjb
Date: Thu Apr 13 17:30:33 2017
New Revision: 316775
URL: https://svnweb.freebsd.org/changeset/base/316775

Log:
  Fix a grammar nit.
  
  Submitted by:	rpokala
  Sponsored by:	The FreeBSD Foundation

Modified:
  user/gjb/thermite/non-release-template-mail.txt

Modified: user/gjb/thermite/non-release-template-mail.txt
==============================================================================
--- user/gjb/thermite/non-release-template-mail.txt	Thu Apr 13 17:16:36 2017	(r316774)
+++ user/gjb/thermite/non-release-template-mail.txt	Thu Apr 13 17:30:33 2017	(r316775)
@@ -41,9 +41,9 @@ o armv6 WANDBOARD
 Note regarding arm/armv6 images: For convenience for those without
 console access to the system, a freebsd user with a password of
 freebsd is available by default for ssh(1) access.  Additionally,
-the root user password is set to root, which it is strongly
-recommended to change the password for both users after gaining
-access to the system.
+the root user password is set to root.  It is strongly recommended
+to change the password for both users after gaining access to the
+system.
 
 Installer images and memory stick images are available here:
 

From owner-svn-src-user@freebsd.org  Sat Apr 15 07:32:59 2017
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BAF5D3E410
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Sat, 15 Apr 2017 07:32:59 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 04A9C6C9;
 Sat, 15 Apr 2017 07:32:58 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3F7Ww4b096926;
 Sat, 15 Apr 2017 07:32:58 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3F7WvZs096921;
 Sat, 15 Apr 2017 07:32:57 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201704150732.v3F7WvZs096921@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Sat, 15 Apr 2017 07:32:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r316954 - user/pho/stress2/misc
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 15 Apr 2017 07:32:59 -0000

Author: pho
Date: Sat Apr 15 07:32:57 2017
New Revision: 316954
URL: https://svnweb.freebsd.org/changeset/base/316954

Log:
  Added gmirror(8) regression tests.
  
  Sponsored by:	Dell EMC Isilon

Added:
  user/pho/stress2/misc/graid1_2.sh   (contents, props changed)
  user/pho/stress2/misc/graid1_3.sh   (contents, props changed)
  user/pho/stress2/misc/graid1_4.sh   (contents, props changed)
  user/pho/stress2/misc/graid1_5.sh   (contents, props changed)
  user/pho/stress2/misc/graid1_6.sh   (contents, props changed)
  user/pho/stress2/misc/graid1_7.sh   (contents, props changed)

Added: user/pho/stress2/misc/graid1_2.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/pho/stress2/misc/graid1_2.sh	Sat Apr 15 07:32:57 2017	(r316954)
@@ -0,0 +1,132 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2017 Dell EMC Isilon
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Test scenario by Mark Johnston <markj@FreeBSD.org>
+# "physwr DL /tmp/graid1_2 /dev/mirror/test" seen.
+# Fixed by r307691.
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+dir=/tmp
+odir=`pwd`
+cd $dir
+sed '1,/^EOF/d' < $odir/$0 > $dir/graid1_2.c
+mycc -o graid1_2 -Wall -Wextra -O0 -g graid1_2.c || exit 1
+rm -f graid1_2.c
+cd $odir
+
+gmirror load > /dev/null 2>&1 && unload=1
+[ -c /dev/mirror/test ] && { gmirror stop test; gmirror destroy test; }
+old=`sysctl -n kern.geom.mirror.debug`
+sysctl kern.geom.mirror.debug=-1 | grep -q -- -1 ||
+    sysctl kern.geom.mirror.debug=$old > /dev/null
+
+md1=$mdstart
+md2=$((mdstart + 1))
+s=0
+size=$((128 * 1024))
+
+for u in $md1 $md2; do
+	dd if=/dev/zero of=/tmp/graid1_2_di$u bs=$size count=1 2>&1 | \
+	    egrep -v "records|transferred"
+	[ -c /dev/md$u ] && mdconfig -d -u $u
+	mdconfig -a -t vnode -f /tmp/graid1_2_di$u -u $u
+done
+gmirror label test /dev/md$md1 /dev/md$md2 || exit 1
+[ -c /dev/mirror/test ] || exit 1
+
+for i in `jot 150`; do /tmp/graid1_2 /dev/mirror/test; done &
+
+sleep 5
+start=`date '+%s'`
+while [ $((`date '+%s'` - start)) -lt 300 ]; do
+	gmirror rebuild test /dev/md$md1
+	sleep 2
+	n=0
+	while ps -l | grep -v grep | grep graid1_2 | grep -q D; do
+		opid=$pid
+		pid=`pgrep graid1_2`
+		[ -z "$pid" -o "$pid" != "$opid" ] && n=0
+		sleep 1
+		n=$((n + 1))
+		if [ $n -gt 180 ]; then
+			echo FAIL
+			ps -l | grep -v grep | grep graid1_2 | grep D
+			exit 1
+		fi
+	done
+done
+kill $! 2>/dev/null
+pkill graid1_2
+wait
+
+while mount | grep $mntpoint | grep -q /mirror/; do
+	umount $mntpoint || sleep 1
+done
+gmirror stop test || s=2
+[ $unload ] && gmirror unload
+
+for u in $md3 $md2 $md1; do
+	mdconfig -d -u $u || s=4
+done
+rm -d /tmp/graid1_2 /tmp/graid1_2_di?
+exit $s
+EOF
+/* Write last sector on disk */
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+static char buf[512];
+
+int
+main(int argc __unused, char *argv[])
+{
+	time_t start;
+	int fd;
+
+	if ((fd = open(argv[1], O_RDWR)) == -1)
+		err(1, "open(%s)", argv[1]);
+	start = time(NULL);
+	while (time(NULL) - start < 2) {
+			if (lseek(fd, 254 * sizeof(buf), SEEK_SET) == -1)
+			err(1, "seek");
+		if (write(fd, buf, sizeof(buf)) != sizeof(buf))
+			err(1, "write");
+	}
+	close(fd);
+
+	return (0);
+}

Added: user/pho/stress2/misc/graid1_3.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/pho/stress2/misc/graid1_3.sh	Sat Apr 15 07:32:57 2017	(r316954)
@@ -0,0 +1,94 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2017 Dell EMC Isilon
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+# Test scenario by Mark Johnston <markj@FreeBSD.org>
+
+# Page fault seen:
+# https://people.freebsd.org/~pho/stress/log/graid1_3.txt
+
+. ../default.cfg
+
+gmirror load > /dev/null 2>&1 && unload=1
+[ -c /dev/mirror/markj-mirror ] &&
+    { gmirror stop markj-mirror; gmirror destroy markj-mirror; }
+old=`sysctl -n kern.geom.mirror.debug`
+sysctl kern.geom.mirror.debug=-1 | grep -q -- -1 ||
+    sysctl kern.geom.mirror.debug=$old > /dev/null
+u1=$mdstart
+u2=$((mdstart + 1))
+size=$((5 * 1024  * 1024))
+for u in $u1 $u2; do
+	dd if=/dev/zero of=/tmp/graid1_2_di$u bs=$size count=1 2>&1 | \
+	    egrep -v "records|transferred"
+	[ -c /dev/md$u ] && mdconfig -d -u $u
+	mdconfig -a -t vnode -f /tmp/graid1_2_di$u -u $u
+done
+set -e
+
+(
+gpart create -s GPT md$u1
+gpart create -s GPT md$u2
+gpart add -t freebsd-ufs -s 1M md$u1
+gpart add -t freebsd-ufs -s 1M md$u2
+) > /dev/null
+
+gmirror label markj-mirror md${u1}p1
+set +e
+
+while true; do
+	gmirror label markj-mirror md${u1}p1
+       	gmirror destroy markj-mirror
+done 2>/dev/null &
+pid1=$!
+while true; do
+	gmirror insert markj-mirror md${u2}p1
+	gmirror remove markj-mirror md${u2}p1
+done 2>/dev/null &
+pid2=$!
+
+for i in `jot 60`; do
+	gmirror list markj-mirror
+	sleep 1
+done > /dev/null 2>&1
+sleep 60
+
+kill $pid1 $pid2
+wait
+sleep 1
+
+gmirror remove markj-mirror md${u2}p1 > /dev/null 2>&1
+gmirror destroy markj-mirror > /dev/null 2>&1
+
+mdconfig -d -u $u1 || exit 1
+mdconfig -d -u $u2 || exit 1
+rm -f /tmp/graid1_2_di*
+exit 0

Added: user/pho/stress2/misc/graid1_4.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/pho/stress2/misc/graid1_4.sh	Sat Apr 15 07:32:57 2017	(r316954)
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2017 Dell EMC Isilon
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Non UFS SU gmirror stop -f test.
+
+# Page fault seen:
+# https://people.freebsd.org/~pho/stress/log/graid1_4.txt
+# Fixed in r316867
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+rm -f ${diskimage}*
+need=1024 # MB
+[ `df -k $(dirname $diskimage) | tail -1 | awk '{print int($4 / 1024)'}` -lt \
+    $need ] && printf "Need %d MB on %s.\n" $need `dirname $diskimage` && exit
+
+gmirror load > /dev/null 2>&1 && unload=1
+[ -c /dev/mirror/test ] && { gmirror stop test; gmirror destroy test; }
+old=`sysctl -n kern.geom.mirror.debug`
+sysctl kern.geom.mirror.debug=-1 | grep -q -- -1 ||
+    sysctl kern.geom.mirror.debug=$old > /dev/null
+
+md1=$mdstart
+md2=$((mdstart + 1))
+
+s=0
+for u in $md1 $md2; do
+	disk="$diskimage.$u"
+	dd if=/dev/zero of=$disk bs=1m count=512 2>&1 | \
+	    egrep -v "records|transferred"
+	[ -c /dev/md$u ] && mdconfig -d -u $u
+	mdconfig -a -t vnode -f $disk -u $u
+done
+
+gmirror label -v -b split -s 2048 test /dev/md$md1 /dev/md$md2 \
+    > /dev/null || exit 1
+[ -c /dev/mirror/test ] || exit 1
+# Soft Updates issues with removal of backing media
+newfs /dev/mirror/test > /dev/null
+mount /dev/mirror/test $mntpoint
+chmod 777 $mntpoint
+
+export runRUNTIME=10m
+export RUNDIR=$mntpoint/stressX
+
+su $testuser -c 'cd ..; ./run.sh marcus.cfg' &
+
+while kill -0 $! > /dev/null 2>&1; do
+	sleep `jot -r 1 1 5`
+	gmirror remove test md$md2
+	sleep `jot -r 1 1 5`
+	gmirror insert test md$md2
+done
+wait
+
+gmirror stop -f test # Note the stop *before* umount
+
+while mount | grep $mntpoint | grep -q /mirror/; do
+	umount $mntpoint || sleep 1
+done
+gmirror stop test || s=1
+gmirror destroy test 2>/dev/null
+[ $unload ] && gmirror unload
+
+for u in $md3 $md2 $md1; do
+	mdconfig -d -u $u || s=3
+done
+rm -f $diskimage*
+exit $s

Added: user/pho/stress2/misc/graid1_5.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/pho/stress2/misc/graid1_5.sh	Sat Apr 15 07:32:57 2017	(r316954)
@@ -0,0 +1,111 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2017 Dell EMC Isilon
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Mirror tests with gnop(8) errors introduced in 2 out of three partitions.
+
+# No problems seen.
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+gmirror load > /dev/null 2>&1 && unload=1
+[ -c /dev/mirror/test ] && { gmirror stop test; gmirror destroy test; }
+old=`sysctl -n kern.geom.mirror.debug`
+sysctl kern.geom.mirror.debug=-1 | grep -q -- -1 ||
+	sysctl kern.geom.mirror.debug=$old > /dev/null
+kldstat | grep -q geom_nop || { gnop load 2>/dev/null || exit 0; }
+gnop status || exit 0
+
+u1=$mdstart
+u2=$((mdstart + 1))
+u3=$((mdstart + 2))
+s=0
+for u in $u1 $u2 $u3; do
+	[ -c /dev/md$u ] && mdconfig -d -u $u
+	mdconfig -a -t swap -s 341m -u $u
+	gpart create -s GPT md$u
+done > /dev/null
+
+set -e
+(
+gpart add -t freebsd-ufs -s 340m md$u1
+gpart add -t freebsd-ufs -s 340m md$u2
+gpart add -t freebsd-ufs -s 340m md$u3
+) > /dev/null
+gnop create md$u2
+gnop create md$u3
+gmirror label test md${u1}p1 md${u2}.nopp1 md${u3}.nopp1
+[ -c /dev/mirror/test ] || exit 1
+
+newfs /dev/mirror/test > /dev/null
+mount /dev/mirror/test $mntpoint
+set +e
+chmod 777 $mntpoint
+
+export runRUNTIME=5m
+export RUNDIR=$mntpoint/stressX
+rm -rf /tmp/stressX.control
+
+su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null 2>&1 &
+pid=$!
+
+gnop configure -r 0 -w 1 md${u2}.nop
+gnop configure -r 0 -w 1 md${u3}.nop
+while kill -0 $pid > /dev/null 2>&1; do
+	if ! gmirror status test | grep -q md${u2}.nopp1; then
+		gmirror forget test
+		gmirror remove test md${u2}.nopp1 2>/dev/null
+		gmirror insert test md${u2}.nopp1 2>/dev/null
+	fi
+	if ! gmirror status test | grep -q md${u3}.nopp1; then
+		gmirror forget test
+		gmirror remove test md${u3}.nopp1 2>/dev/null
+		gmirror insert test md${u3}.nopp1 2>/dev/null
+	fi
+	sleep 1
+done
+wait
+
+while mount | grep $mntpoint | grep -q /mirror/; do
+	umount $mntpoint || sleep 5
+done
+while gmirror status test | grep -q SYNCHRONIZING; do sleep 10; done
+for i in `jot 10`; do
+	gmirror stop test && break || sleep 30
+done
+[ $i -eq 10 ] && s=1
+gmirror destroy test 2>/dev/null
+[ $unload ] && gmirror unload
+
+for u in $u1 $u2 $u3; do
+	mdconfig -d -u $u || s=3
+done
+exit $s

Added: user/pho/stress2/misc/graid1_6.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/pho/stress2/misc/graid1_6.sh	Sat Apr 15 07:32:57 2017	(r316954)
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2017 Dell EMC Isilon
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Variation of graid1_4.sh
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+rm -f ${diskimage}*
+need=1024 # MB
+[ `df -k $(dirname $diskimage) | tail -1 | awk '{print int($4 / 1024)'}` -lt \
+    $need ] && printf "Need %d MB on %s.\n" $need `dirname $diskimage` && exit
+
+gmirror load > /dev/null 2>&1 && unload=1
+[ -c /dev/mirror/test ] && { gmirror stop test; gmirror destroy test; }
+old=`sysctl -n kern.geom.mirror.debug`
+sysctl kern.geom.mirror.debug=-1 | grep -q -- -1 ||
+    sysctl kern.geom.mirror.debug=$old > /dev/null
+
+md1=$mdstart
+md2=$((mdstart + 1))
+
+s=0
+for u in $md1 $md2; do
+	disk="$diskimage.$u"
+	dd if=/dev/zero of=$disk bs=1m count=512 2>&1 | \
+	    egrep -v "records|transferred"
+	[ -c /dev/md$u ] && mdconfig -d -u $u
+	mdconfig -a -t vnode -f $disk -u $u
+done
+
+gmirror label -v -b split -s 2048 test /dev/md$md1 /dev/md$md2 \
+    > /dev/null || exit 1
+[ -c /dev/mirror/test ] || exit 1
+newfs $newfs_flags /dev/mirror/test > /dev/null
+mount /dev/mirror/test $mntpoint
+chmod 777 $mntpoint
+
+export runRUNTIME=4m
+export RUNDIR=$mntpoint/stressX
+
+su $testuser -c 'cd ..; ./run.sh marcus.cfg' &
+
+while kill -0 $! > /dev/null 2>&1; do
+	sleep `jot -r 1 1 5`
+	gmirror remove test md$md2
+	sleep `jot -r 1 1 5`
+	gmirror insert test md$md2
+done
+wait
+
+while mount | grep $mntpoint | grep -q /mirror/; do
+	umount $mntpoint || sleep 1
+done
+gmirror stop -f test ||s=1
+gmirror destroy test 2>/dev/null
+[ $unload ] && gmirror unload
+
+for u in $md3 $md2 $md1; do
+	mdconfig -d -u $u || s=3
+done
+rm -f $diskimage*
+exit $s

Added: user/pho/stress2/misc/graid1_7.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/pho/stress2/misc/graid1_7.sh	Sat Apr 15 07:32:57 2017	(r316954)
@@ -0,0 +1,110 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2017 Dell EMC Isilon
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Component looses it's name:
+# g_dev_taste: make_dev_p() failed
+# (gp->name=gptid/7c598e03-19cb-11e7-b62b-001e6756c168, error=17)
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+gmirror load > /dev/null 2>&1 && unload=1
+[ -c /dev/mirror/test ] && { gmirror stop test; gmirror destroy test; }
+old=`sysctl -n kern.geom.mirror.debug`
+sysctl kern.geom.mirror.debug=-1 | grep -q -- -1 ||
+    sysctl kern.geom.mirror.debug=$old > /dev/null
+kldstat | grep -q geom_nop || { gnop load 2>/dev/null || exit 0; }
+gnop status || exit 0
+
+u1=$mdstart
+s=0
+[ -c /dev/md$u1 ] && mdconfig -d -u $u1
+mdconfig -a -t swap -s 1g -u $u1
+
+set -e
+(
+gpart create -s GPT md$u1
+gpart add -t freebsd-ufs -s 341m md$u1
+gpart add -t freebsd-ufs -s 341m md$u1
+gpart add -t freebsd-ufs -s 341m md$u1
+) > /dev/null
+gmirror label test md${u1}p1 md${u1}p2 md${u1}p3
+[ -c /dev/mirror/test ] || exit 1
+
+newfs /dev/mirror/test > /dev/null
+mount /dev/mirror/test $mntpoint
+set +e
+chmod 777 $mntpoint
+
+export runRUNTIME=5m
+export RUNDIR=$mntpoint/stressX
+rm -rf /tmp/stressX.control
+
+su $testuser -c 'cd ..; ./run.sh io.cfg' > /dev/null 2>&1 &
+pid=$!
+
+sleep 2
+cont=/tmp/graid1_7.cont
+touch $cont
+for i in `jot 8`; do
+	while [ -f $cont ]; do
+		for u in md${u1}p2 md${u1}p3; do
+			gmirror forget test
+			gmirror remove test $u
+			gmirror insert test $u
+			id=`gmirror status test | grep gptid | awk '{print $1}'`
+			if [ $i -eq 1 -a -n "$id" ]; then
+				echo "FAIL Remove component $id"
+				gmirror remove test $id
+			fi
+		done 2>/dev/null
+	done &
+done
+while kill -0 $pid 2>/dev/null; do sleep 5; done
+rm $cont
+wait
+gmirror status test | grep -qw md${u1}p2 || gmirror insert test md${u1}p2
+gmirror status test | grep -qw md${u1}p3 || gmirror insert test md${u1}p3
+while ! gmirror status test | grep -q COMPLETE; do sleep 5; done
+
+while mount | grep $mntpoint | grep -q /mirror/; do
+	umount $mntpoint || sleep 5
+done
+while gmirror status test | grep -q SYNCHRONIZING; do sleep 10; done
+for i in `jot 10`; do
+	gmirror stop test && break || sleep 30
+done
+[ $i -eq 10 ] && s=1
+gmirror destroy test 2>/dev/null
+[ $unload ] && gmirror unload
+
+mdconfig -d -u $mdstart || s=3
+exit $s

From owner-svn-src-user@freebsd.org  Sat Apr 15 15:14:02 2017
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19CFCD3E7D2
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Sat, 15 Apr 2017 15:14:02 +0000 (UTC)
 (envelope-from yaneurabeya@gmail.com)
Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com
 [IPv6:2607:f8b0:400e:c05::244])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id DE40AD90;
 Sat, 15 Apr 2017 15:14:01 +0000 (UTC)
 (envelope-from yaneurabeya@gmail.com)
Received: by mail-pg0-x244.google.com with SMTP id 63so7251708pgh.0;
 Sat, 15 Apr 2017 08:14:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=content-transfer-encoding:from:mime-version:subject:date:message-id
 :references:cc:in-reply-to:to;
 bh=gdnhd/aNWbFZmMdKcaN3DhQ+aKUnsMNzpBnVieajZ2w=;
 b=EdUc6FAv9CQaQ+D6zKhBhttKss0/KblECepnh1wxRfC6qBYodLL53PBxcNZfodVkqS
 EP52i/DyvbPdqdbHBcauGZH+CwwFXJLoghfc2FS0ywP14sDy7fN1uQDwOvLI/kBiWW9W
 Io/GHjL4bBEua1LsDbp/qxnbzw62K7hHdEwcfpKofhqq+RcV/ygE+jYT/fsObSN2CpgZ
 Y6SIfmY3qZ9XROs5Uh6g/6DU41a/8Jwq1M5MmEEqELGHibPQChNY6Sm4I33+WM/wzMVn
 u3Tf198ETrnzKmBwIJDhW4K8kLGV3MtEL271856JOCV9BSKCNuyWrRSLbhsPF84W3XrQ
 7gTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:content-transfer-encoding:from:mime-version
 :subject:date:message-id:references:cc:in-reply-to:to;
 bh=gdnhd/aNWbFZmMdKcaN3DhQ+aKUnsMNzpBnVieajZ2w=;
 b=FFCGxxnZ+nDkmamFpFJ0yuDxDv0IiZiZsWhCl3B9y9KanXQ/+DMfsCKmhB7zbcRDBF
 oiQAxnFF+G8X33dCtj7RdqktVszCUqvwJJjUP6jCE4+mBP4f7h4lbAhvcHFm6H2481xO
 DJzOpt3SCJM8zw4Z7jcGUE9DrQ4+5wnMb0XvZGxgNaUQHAZVYXv/hmdH6JuwiNJF8dOG
 YqMi/LehY/VWR74Uilak8Paahe9cgtUzX+YN5C7V77UQY29+W1WG629QrocgYYVRI3Ch
 OclhtKNRLXS6YP3oOJs4tJ7vBSp2RR0ltDLne4IIE+9NnuqoNF0LpQN1RIb2oxBtswgc
 m+rg==
X-Gm-Message-State: AN3rC/4kH9P20slx8KaambJdM2xN7A+crEMTl91FeqmMqHpp+1IENLXN
 6dJ7wtlUKRvvolUDA2A=
X-Received: by 10.98.137.68 with SMTP id v65mr3095230pfd.125.1492269241251;
 Sat, 15 Apr 2017 08:14:01 -0700 (PDT)
Received: from [192.168.20.13] (c-73-19-52-228.hsd1.wa.comcast.net.
 [73.19.52.228])
 by smtp.gmail.com with ESMTPSA id y29sm9141643pfj.90.2017.04.15.08.14.00
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 15 Apr 2017 08:14:00 -0700 (PDT)
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Ngie Cooper <yaneurabeya@gmail.com>
Mime-Version: 1.0 (1.0)
Subject: Re: svn commit: r316954 - user/pho/stress2/misc
Date: Sat, 15 Apr 2017 08:13:43 -0700
Message-Id: <CF6A4CC5-427C-4B58-97BD-C8B76EBB19FA@gmail.com>
References: <201704150732.v3F7WvZs096921@repo.freebsd.org>
Cc: src-committers@freebsd.org, svn-src-user@freebsd.org
In-Reply-To: <201704150732.v3F7WvZs096921@repo.freebsd.org>
To: Peter Holm <pho@FreeBSD.org>
X-Mailer: iPhone Mail (14E304)
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 15 Apr 2017 15:14:02 -0000


> On Apr 15, 2017, at 00:32, Peter Holm <pho@FreeBSD.org> wrote:
> 
> Author: pho
> Date: Sat Apr 15 07:32:57 2017
> New Revision: 316954
> URL: https://svnweb.freebsd.org/changeset/base/316954
> 
> Log:
>  Added gmirror(8) regression tests.
> 
>  Sponsored by:    Dell EMC Isilon
> 
> Added:
>  user/pho/stress2/misc/graid1_2.sh   (contents, props changed)
>  user/pho/stress2/misc/graid1_3.sh   (contents, props changed)
>  user/pho/stress2/misc/graid1_4.sh   (contents, props changed)
>  user/pho/stress2/misc/graid1_5.sh   (contents, props changed)
>  user/pho/stress2/misc/graid1_6.sh   (contents, props changed)
>  user/pho/stress2/misc/graid1_7.sh   (contents, props changed)

Hi Peter!
    Did you mean for the test scripts to start with graid instead of gmirror?
Thanks!
-Ngie

From owner-svn-src-user@freebsd.org  Sat Apr 15 15:34:31 2017
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BE8DD3F000
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Sat, 15 Apr 2017 15:34:31 +0000 (UTC) (envelope-from pho@holm.cc)
Received: from relay01.pair.com (relay01.pair.com [209.68.5.15])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 3BEACFDF;
 Sat, 15 Apr 2017 15:34:30 +0000 (UTC) (envelope-from pho@holm.cc)
Received: from x2.osted.lan (87-58-223-204-dynamic.dk.customer.tdc.net
 [87.58.223.204])
 by relay01.pair.com (Postfix) with ESMTP id 6271AD00ACC;
 Sat, 15 Apr 2017 11:34:28 -0400 (EDT)
Received: from x2.osted.lan (localhost [127.0.0.1])
 by x2.osted.lan (8.14.9/8.14.9) with ESMTP id v3FFYQ4Y018008
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Sat, 15 Apr 2017 17:34:27 +0200 (CEST)
 (envelope-from pho@x2.osted.lan)
Received: (from pho@localhost)
 by x2.osted.lan (8.14.9/8.14.9/Submit) id v3FFYQRU018007;
 Sat, 15 Apr 2017 17:34:26 +0200 (CEST) (envelope-from pho)
Date: Sat, 15 Apr 2017 17:34:26 +0200
From: Peter Holm <peter@holm.cc>
To: Ngie Cooper <yaneurabeya@gmail.com>
Cc: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: Re: svn commit: r316954 - user/pho/stress2/misc
Message-ID: <20170415153426.GA17423@x2.osted.lan>
References: <201704150732.v3F7WvZs096921@repo.freebsd.org>
 <CF6A4CC5-427C-4B58-97BD-C8B76EBB19FA@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CF6A4CC5-427C-4B58-97BD-C8B76EBB19FA@gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 15 Apr 2017 15:34:31 -0000

On Sat, Apr 15, 2017 at 08:13:43AM -0700, Ngie Cooper wrote:
> 
> > On Apr 15, 2017, at 00:32, Peter Holm <pho@FreeBSD.org> wrote:
> > 
> > Author: pho
> > Date: Sat Apr 15 07:32:57 2017
> > New Revision: 316954
> > URL: https://svnweb.freebsd.org/changeset/base/316954
> > 
> > Log:
> >  Added gmirror(8) regression tests.
> > 
> >  Sponsored by:    Dell EMC Isilon
> > 
> > Added:
> >  user/pho/stress2/misc/graid1_2.sh   (contents, props changed)
> >  user/pho/stress2/misc/graid1_3.sh   (contents, props changed)
> >  user/pho/stress2/misc/graid1_4.sh   (contents, props changed)
> >  user/pho/stress2/misc/graid1_5.sh   (contents, props changed)
> >  user/pho/stress2/misc/graid1_6.sh   (contents, props changed)
> >  user/pho/stress2/misc/graid1_7.sh   (contents, props changed)
> 
> Hi Peter!
>     Did you mean for the test scripts to start with graid instead of gmirror?
> Thanks!
> -Ngie

I already had tests named graid0.sh, graid1.sh and graid3.sh, so
that seemed natural to me. But I have no strong feelings about test
script names.
-- 
Peter