Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2016 07:23:58 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r307275 - stable/11/cddl/contrib/opensolaris/cmd/ztest
Message-ID:  <201610140723.u9E7NwbK064797@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Oct 14 07:23:58 2016
New Revision: 307275
URL: https://svnweb.freebsd.org/changeset/base/307275

Log:
  MFC r305328: MFV r303081: 7163 ztest failures due to excess error injection
  
  illumos/illumos-gate@f34284d835bc555f987c1310df46c034c3101155
  https://github.com/illumos/illumos-gate/commit/f34284d835bc555f987c1310df46c034c
  3101155
  
  https://www.illumos.org/issues/7163
    Running zloop from zfs-precommit hit this assertion:
         *panicstr/s
    0xfffffd7fd7419370: assertion failed for thread 0xfffffd7fe29ed240,
    thread-id 577: parent != NULL, file ../../../uts/common/fs/zfs/dbuf.c, line
    1827
         $c
    libc.so.1`_lwp_kill+0xa()
    libc.so.1`_assfail+0x182(fffffd7ffb1c29fa, fffffd7ffb1cc028, 723)
    libc.so.1`assfail+0x19(fffffd7ffb1c29fa, fffffd7ffb1cc028, 723)
    libzpool.so.1`dbuf_dirty+0xc69(10e3bc10, 3601700)
    libzpool.so.1`dbuf_dirty+0x61e(10c73640, 3601700)
    libzpool.so.1`dbuf_dirty+0x61e(10e28280, 3601700)
    libzpool.so.1`dmu_buf_will_fill+0x64(10e28280, 3601700)
    libzpool.so.1`dmu_write+0x1b6(2c7e640, d, 400000002e000000, 200, 3717b40,
    3601700)
    ztest_replay_write+0x568(4950d0, 3717a80, 0)
    ztest_write+0x125(4950d0, d, 400000002e000000, 200, 413f000)
    ztest_io+0x1bb(4950d0, d, 400000002e000000)
    ztest_dmu_write_parallel+0xaa(4950d0, 6)
    ztest_execute+0x83(1, 420c98, 6)
    ztest_thread+0xf4(6)
    libc.so.1`_thrp_setup+0x8a(fffffd7fe29ed240)
    libc.so.1`_lwp_start()
    This is another manifestation of ECKSUM in ztest:
    The lowest level ancestor that’s in memory is the L8 (topmost). The L7
    ancestor is blkid 0x10:
         ::dbufs -O 0x2c7e640 -o d -l 7 |::dbuf
    addr object lvl blkid holds os
    600be50 d 7 4 1 ztest/ds_6
    719d880 d 7 0 4 ztest/ds_6
  
  Reviewed by: George Wilson <george.wilson@delphix.com>
  Reviewed by: Paul Dagnelie <pcd@delphix.com>
  Approved by: Robert Mustacchi <rm@joyent.com>
  Author: Matthew Ahrens <mahrens@delphix.com>

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==============================================================================
--- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Fri Oct 14 07:22:44 2016	(r307274)
+++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Fri Oct 14 07:23:58 2016	(r307275)
@@ -4793,7 +4793,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint6
 	char path0[MAXPATHLEN];
 	char pathrand[MAXPATHLEN];
 	size_t fsize;
-	int bshift = SPA_MAXBLOCKSHIFT + 2;	/* don't scrog all labels */
+	int bshift = SPA_MAXBLOCKSHIFT + 2;
 	int iters = 1000;
 	int maxfaults;
 	int mirror_save;
@@ -4983,7 +4983,29 @@ ztest_fault_inject(ztest_ds_t *zd, uint6
 		    (leaves << bshift) + (leaf << bshift) +
 		    (ztest_random(1ULL << (bshift - 1)) & -8ULL);
 
-		if (offset >= fsize)
+		/*
+		 * Only allow damage to the labels at one end of the vdev.
+		 *
+		 * If all labels are damaged, the device will be totally
+		 * inaccessible, which will result in loss of data,
+		 * because we also damage (parts of) the other side of
+		 * the mirror/raidz.
+		 *
+		 * Additionally, we will always have both an even and an
+		 * odd label, so that we can handle crashes in the
+		 * middle of vdev_config_sync().
+		 */
+		if ((leaf & 1) == 0 && offset < VDEV_LABEL_START_SIZE)
+			continue;
+
+		/*
+		 * The two end labels are stored at the "end" of the disk, but
+		 * the end of the disk (vdev_psize) is aligned to
+		 * sizeof (vdev_label_t).
+		 */
+		uint64_t psize = P2ALIGN(fsize, sizeof (vdev_label_t));
+		if ((leaf & 1) == 1 &&
+		    offset + sizeof (bad) > psize - VDEV_LABEL_END_SIZE)
 			continue;
 
 		VERIFY(mutex_lock(&ztest_vdev_lock) == 0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610140723.u9E7NwbK064797>