diff options
| author | Matthew Ahrens <mahrens@delphix.com> | 2016-07-19 16:03:51 -0700 |
|---|---|---|
| committer | Matthew Ahrens <mahrens@delphix.com> | 2016-07-19 16:33:17 -0700 |
| commit | f34284d835bc555f987c1310df46c034c3101155 (patch) | |
| tree | 33e9fa7e3234c78e5437e3418e6c289f7c3eb3c2 /usr/src | |
| parent | 9ec0cbeb1b55d91f199d8341727999ac1cc445cb (diff) | |
| download | illumos-joyent-f34284d835bc555f987c1310df46c034c3101155.tar.gz | |
7163 ztest failures due to excess error injection
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/cmd/ztest/ztest.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c index 0d3e5ff711..b4d979ba05 100644 --- a/usr/src/cmd/ztest/ztest.c +++ b/usr/src/cmd/ztest/ztest.c @@ -4792,7 +4792,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) 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; @@ -4982,7 +4982,29 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) (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); |
