diff options
author | Tom Caputi <[email protected]> | 2018-08-29 14:33:33 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-08-29 11:33:33 -0700 |
commit | c3bd3fb4ac49705819666055ff1206a9fa3d1b9e (patch) | |
tree | a10014775357e89313ea994c672685549e40fcaa /module/zfs/zio_compress.c | |
parent | 47ab01a18f55f89be7b3f340b6ec9101bf9e231c (diff) |
OpenZFS 9403 - assertion failed in arc_buf_destroy()
Assertion failed in arc_buf_destroy() when concurrently reading
block with checksum error.
Porting notes:
* The ability to zinject decompression errors has been added, but
this only works at the zio_decompress() level, where we have all
of the info we need to match against the user's zinject options.
* The decompress_fault test has been added to test the new zinject
functionality
* We attempted to set zio_decompress_fail_fraction to (1 << 18) in
ztest for further test coverage. Although this did uncover a few
low priority issues, this unfortuantely also causes ztest to
ASSERT in many locations where the code is working correctly since
it is designed to fail on IO errors. Developers can manually set
this variable with the '-o' option to find and debug issues.
Authored by: Matt Ahrens <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: Paul Dagnelie <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>
Reviewed by: Brian Behlendorf <[email protected]>
Approved by: Matt Ahrens <[email protected]>
Ported-by: Tom Caputi <[email protected]>
OpenZFS-issue: https://illumos.org/issues/9403
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/fa98e487a9
Closes #7822
Diffstat (limited to 'module/zfs/zio_compress.c')
-rw-r--r-- | module/zfs/zio_compress.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/module/zfs/zio_compress.c b/module/zfs/zio_compress.c index 971e8de8b..f5cbc3e82 100644 --- a/module/zfs/zio_compress.c +++ b/module/zfs/zio_compress.c @@ -28,7 +28,7 @@ */ /* - * Copyright (c) 2013, 2016 by Delphix. All rights reserved. + * Copyright (c) 2013, 2018 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> @@ -38,6 +38,12 @@ #include <sys/zio_compress.h> /* + * If nonzero, every 1/X decompression attempts will fail, simulating + * an undetected memory error. + */ +unsigned long zio_decompress_fail_fraction = 0; + +/* * Compression vectors. */ zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = { @@ -148,5 +154,15 @@ zio_decompress_data(enum zio_compress c, abd_t *src, void *dst, int ret = zio_decompress_data_buf(c, tmp, dst, s_len, d_len); abd_return_buf(src, tmp, s_len); + /* + * Decompression shouldn't fail, because we've already verifyied + * the checksum. However, for extra protection (e.g. against bitflips + * in non-ECC RAM), we handle this error (and test it). + */ + ASSERT0(ret); + if (zio_decompress_fail_fraction != 0 && + spa_get_random(zio_decompress_fail_fraction) == 0) + ret = SET_ERROR(EINVAL); + return (ret); } |