-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenZFS 9403 - assertion failed in arc_buf_destroy() when concurrentl… #7822
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
@@ -37,6 +37,12 @@ | |
#include <sys/zio.h> | ||
#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. | ||
*/ | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After taking a second look at this I think it's worth doing this decompress error injection with This makes the code consistent and allows for an easy test case by adding a new |
||
|
||
return (ret); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/ksh -p | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# | ||
|
||
# | ||
# Copyright (c) 2018 by Datto Inc. | ||
# All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/fault/fault.cfg | ||
|
||
# | ||
# DESCRIPTION: | ||
# Test that injected decompression errors are handled correctly. | ||
# | ||
# STRATEGY: | ||
# 1. Create an compressed dataset with a test file | ||
# 2. Inject decompression errors on the file 20% of the time | ||
# 3. Read the file to confirm that errors are handled correctly | ||
# 4. Confirm that the decompression injection was added to the ZED logs | ||
# | ||
|
||
log_assert "Testing that injected decompression errors are handled correctly" | ||
|
||
function cleanup | ||
{ | ||
log_must set_tunable64 zfs_compressed_arc_enabled 1 | ||
log_must zinject -c all | ||
default_cleanup_noexit | ||
} | ||
|
||
log_onexit cleanup | ||
|
||
default_mirror_setup_noexit $DISK1 $DISK2 | ||
log_must set_tunable64 zfs_compressed_arc_enabled 0 | ||
log_must zfs create -o compression=on $TESTPOOL/fs | ||
mntpt=$(get_prop mountpoint $TESTPOOL/fs) | ||
write_compressible $mntpt 32m 1 0 "testfile" | ||
log_must sync | ||
log_must zfs umount $TESTPOOL/fs | ||
log_must zfs mount $TESTPOOL/fs | ||
log_must zinject -a -t data -e decompress -f 20 $mntpt/testfile.0 | ||
log_mustnot eval "cat $mntpt/testfile.0 > /dev/null" | ||
log_must eval "zpool events $TESTPOOL | grep -q 'data'" | ||
|
||
log_pass "Injected decompression errors are handled correctly" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you accidentally dropped an ASSERT from the OpenZFS version which should be here.
There are also two additional ASSERTs which were lost and should be added to
dbuf_prefetch_indirect_done()
.