diff options
author | Tom Caputi <[email protected]> | 2018-03-31 14:12:51 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-03-31 11:12:51 -0700 |
commit | a2c2ed1bd4c3dc6d52b6058b9c74245cad2ae331 (patch) | |
tree | de5ad1fd1bc04f0ee496316305871d0b0e26d74e /include | |
parent | 4515b1d01c936b8cf156e20ba42cdb8916bca80b (diff) |
Decryption error handling improvements
Currently, the decryption and block authentication code in
the ZIO / ARC layers is a bit inconsistent with regards to
the ereports that are produces and the error codes that are
passed to calling functions. This patch ensures that all of
these errors (which begin as ECKSUM) are converted to EIO
before they leave the ZIO or ARC layer and that ereports
are correctly generated on each decryption / authentication
failure.
In addition, this patch fixes a bug in zio_decrypt() where
ECKSUM never gets written to zio->io_error.
Reviewed by: Matt Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tom Caputi <[email protected]>
Closes #7372
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/arc.h | 2 | ||||
-rw-r--r-- | include/sys/spa.h | 3 | ||||
-rw-r--r-- | include/sys/zio.h | 9 |
3 files changed, 8 insertions, 6 deletions
diff --git a/include/sys/arc.h b/include/sys/arc.h index de280362d..9d6bab505 100644 --- a/include/sys/arc.h +++ b/include/sys/arc.h @@ -237,7 +237,7 @@ boolean_t arc_is_unauthenticated(arc_buf_t *buf); enum zio_compress arc_get_compression(arc_buf_t *buf); void arc_get_raw_params(arc_buf_t *buf, boolean_t *byteorder, uint8_t *salt, uint8_t *iv, uint8_t *mac); -int arc_untransform(arc_buf_t *buf, spa_t *spa, uint64_t dsobj, +int arc_untransform(arc_buf_t *buf, spa_t *spa, const zbookmark_phys_t *zb, boolean_t in_place); void arc_convert_to_raw(arc_buf_t *buf, uint64_t dsobj, boolean_t byteorder, dmu_object_type_t ot, const uint8_t *salt, const uint8_t *iv, diff --git a/include/sys/spa.h b/include/sys/spa.h index 62832eff0..4a1b1410f 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -1024,7 +1024,8 @@ extern void spa_history_log_internal_dd(dsl_dir_t *dd, const char *operation, struct zbookmark_phys; extern void spa_log_error(spa_t *spa, const zbookmark_phys_t *zb); extern void zfs_ereport_post(const char *class, spa_t *spa, vdev_t *vd, - zbookmark_phys_t *zb, zio_t *zio, uint64_t stateoroffset, uint64_t length); + const zbookmark_phys_t *zb, zio_t *zio, uint64_t stateoroffset, + uint64_t length); extern nvlist_t *zfs_event_create(spa_t *spa, vdev_t *vd, const char *type, const char *name, nvlist_t *aux); extern void zfs_post_remove(spa_t *spa, vdev_t *vd); diff --git a/include/sys/zio.h b/include/sys/zio.h index 9d3adb7f5..be8e18b4b 100644 --- a/include/sys/zio.h +++ b/include/sys/zio.h @@ -649,8 +649,8 @@ extern hrtime_t zio_handle_io_delay(zio_t *zio); * Checksum ereport functions */ extern void zfs_ereport_start_checksum(spa_t *spa, vdev_t *vd, - zbookmark_phys_t *zb, struct zio *zio, uint64_t offset, uint64_t length, - void *arg, struct zio_bad_cksum *info); + const zbookmark_phys_t *zb, struct zio *zio, uint64_t offset, + uint64_t length, void *arg, struct zio_bad_cksum *info); extern void zfs_ereport_finish_checksum(zio_cksum_report_t *report, const abd_t *good_data, const abd_t *bad_data, boolean_t drop_if_identical); @@ -658,8 +658,9 @@ extern void zfs_ereport_free_checksum(zio_cksum_report_t *report); /* If we have the good data in hand, this function can be used */ extern void zfs_ereport_post_checksum(spa_t *spa, vdev_t *vd, - zbookmark_phys_t *zb, struct zio *zio, uint64_t offset, uint64_t length, - const abd_t *good_data, const abd_t *bad_data, struct zio_bad_cksum *info); + const zbookmark_phys_t *zb, struct zio *zio, uint64_t offset, + uint64_t length, const abd_t *good_data, const abd_t *bad_data, + struct zio_bad_cksum *info); /* Called from spa_sync(), but primarily an injection handler */ extern void spa_handle_ignored_writes(spa_t *spa); |