From 41425f79dabc58e5ddb16cc701cc435a5480e56a Mon Sep 17 00:00:00 2001 From: George Melikov Date: Tue, 31 Jan 2017 04:12:58 +0300 Subject: [PATCH] OpenZFS 7490 - real checksum errors are silenced when zinject is on Authored by: Pavel Zakharov Reviewed by: George Wilson Reviewed by: Paul Dagnelie Reviewed by: Dan Kimmel Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Reviewed-by: Brian Behlendorf Ported-by: George Melikov OpenZFS-issue: https://www.illumos.org/issues/7490 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/6cedfc3 Closes #5693 --- module/zfs/zio_checksum.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/module/zfs/zio_checksum.c b/module/zfs/zio_checksum.c index 53658daca..e65b3f061 100644 --- a/module/zfs/zio_checksum.c +++ b/module/zfs/zio_checksum.c @@ -20,8 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2013, 2016 by Delphix. All rights reserved. + * Copyright 2013 Saso Kiselkov. All rights reserved. */ #include @@ -441,12 +441,13 @@ zio_checksum_error(zio_t *zio, zio_bad_cksum_t *info) error = zio_checksum_error_impl(spa, bp, checksum, data, size, offset, info); - if (error != 0 && zio_injection_enabled && !zio->io_error && - (error = zio_handle_fault_injection(zio, ECKSUM)) != 0) { - info->zbc_injected = 1; - return (error); + if (zio_injection_enabled && error == 0 && zio->io_error == 0) { + error = zio_handle_fault_injection(zio, ECKSUM); + if (error != 0) + info->zbc_injected = 1; } + return (error); }