summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2015-11-17 12:00:11 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2015-11-17 12:00:11 +0000
commit275d73b3f371fe2c5b2e67a1c86ef4b5781ac33c (patch)
tree9d7d1d59320de0686fa2fbf770be55d114ee628d /usr/src/cmd
parentd3ca33877d23e01eff12715a6c2466f5340f622d (diff)
parent68ecb2ec930c4b0f00acaf8e0abb2b19c4b8b76f (diff)
downloadillumos-joyent-275d73b3f371fe2c5b2e67a1c86ef4b5781ac33c.tar.gz
[illumos-gate merge]
commit 68ecb2ec930c4b0f00acaf8e0abb2b19c4b8b76f 6393 zfs receive a full send as a clone commit 3d729aecc03ea6ebb9bd5d56b8dccd24f57daa41 6342 want signalfd support commit f9eb9fdf196b6ed476e4ffc69cecd8b0da3cb7e7 6451 ztest fails due to checksum errors Conflicts: usr/src/uts/sparc/Makefile.sparc usr/src/uts/common/os/sig.c usr/src/uts/common/io/signalfd.c
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/ztest/ztest.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c
index c5eae695c9..764008f5b8 100644
--- a/usr/src/cmd/ztest/ztest.c
+++ b/usr/src/cmd/ztest/ztest.c
@@ -4780,7 +4780,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
char path0[MAXPATHLEN];
char pathrand[MAXPATHLEN];
size_t fsize;
- int bshift = SPA_OLD_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
+ int bshift = SPA_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
int iters = 1000;
int maxfaults;
int mirror_save;
@@ -4941,6 +4941,31 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
fsize = lseek(fd, 0, SEEK_END);
while (--iters != 0) {
+ /*
+ * The offset must be chosen carefully to ensure that
+ * we do not inject a given logical block with errors
+ * on two different leaf devices, because ZFS can not
+ * tolerate that (if maxfaults==1).
+ *
+ * We divide each leaf into chunks of size
+ * (# leaves * SPA_MAXBLOCKSIZE * 4). Within each chunk
+ * there is a series of ranges to which we can inject errors.
+ * Each range can accept errors on only a single leaf vdev.
+ * The error injection ranges are separated by ranges
+ * which we will not inject errors on any device (DMZs).
+ * Each DMZ must be large enough such that a single block
+ * can not straddle it, so that a single block can not be
+ * a target in two different injection ranges (on different
+ * leaf vdevs).
+ *
+ * For example, with 3 leaves, each chunk looks like:
+ * 0 to 32M: injection range for leaf 0
+ * 32M to 64M: DMZ - no injection allowed
+ * 64M to 96M: injection range for leaf 1
+ * 96M to 128M: DMZ - no injection allowed
+ * 128M to 160M: injection range for leaf 2
+ * 160M to 192M: DMZ - no injection allowed
+ */
offset = ztest_random(fsize / (leaves << bshift)) *
(leaves << bshift) + (leaf << bshift) +
(ztest_random(1ULL << (bshift - 1)) & -8ULL);