Skip to content

Commit

Permalink
Illumos 6451 - ztest fails due to checksum errors
Browse files Browse the repository at this point in the history
6451 ztest fails due to checksum errors
Reviewed by: George Wilson <[email protected]>
Reviewed by: Prakash Surya <[email protected]>
Reviewed by: Jorgen Lundman <[email protected]>
Approved by: Dan McDonald <[email protected]>

References:
  https://www.illumos.org/issues/6451
  illumos/illumos-gate@f9eb9fd

Ported-by: Brian Behlendorf <[email protected]>
  • Loading branch information
ahrens authored and behlendorf committed Jan 25, 2016
1 parent ba5ad9a commit 91d8884
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion cmd/ztest/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -4972,7 +4972,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
char *path0;
char *pathrand;
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;
Expand Down Expand Up @@ -5136,6 +5136,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);
Expand Down

3 comments on commit 91d8884

@Trucido
Copy link

@Trucido Trucido commented on 91d8884 Jun 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this applicable to ZoL (not just illuminos) and a possible candidate for 0.6.5-release? I've been troubleshooting some ztest issues which still occasionally fail on Linux kernels 4.4.11 and 4.4.12 even with commit 151f84e applied, however a few cherry picked patches (including this one) seems to have eliminated the issues, but I'm still trying to narrow down which commit(s).

@behlendorf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trucido yes this applies to ZoL. However, it's probably not a candidate for the 0.6.5-release branch, we try and limit the patches to critical issues which could impact users. ztest isn't something anyone but a developer would run.

@Trucido
Copy link

@Trucido Trucido commented on 91d8884 Jun 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@behlendorf Understood, perhaps I'm not using ztest as intended - however I did see quite a few issues related to it. I'll try zfsstress or other conventional methods. Apologies for any inconvenience I may have caused.

Please sign in to comment.