From 39a39b8ab9f3653b000294c3f2e357db68de3de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 16 Sep 2022 22:59:25 +0200 Subject: [PATCH] =?UTF-8?q?Handle=20ECKSUM=20as=20new=20EZFS=5FCKSUM=20?= =?UTF-8?q?=E2=80=92=20"insufficient=20replicas"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a meaningful error message for ECKSUM to common error messages. Reviewed-by: Richard Yao Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #6805 Closes #13808 Closes #13898 --- include/libzfs.h | 1 + lib/libzfs/libzfs_util.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/libzfs.h b/include/libzfs.h index d55e3f2e73..7c06ebb104 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -150,6 +150,7 @@ typedef enum zfs_error { EZFS_NO_RESILVER_DEFER, /* pool doesn't support resilver_defer */ EZFS_EXPORT_IN_PROGRESS, /* currently exporting the pool */ EZFS_REBUILDING, /* resilvering (sequential reconstrution) */ + EZFS_CKSUM, /* insufficient replicas */ EZFS_UNKNOWN } zfs_error_t; diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 7dd38bb3d8..728b9ab92d 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -170,6 +170,8 @@ libzfs_error_description(libzfs_handle_t *hdl) return (dgettext(TEXT_DOMAIN, "I/O error")); case EZFS_INTR: return (dgettext(TEXT_DOMAIN, "signal received")); + case EZFS_CKSUM: + return (dgettext(TEXT_DOMAIN, "insufficient replicas")); case EZFS_ISSPARE: return (dgettext(TEXT_DOMAIN, "device is reserved as a hot " "spare")); @@ -392,6 +394,10 @@ zfs_common_error(libzfs_handle_t *hdl, int error, const char *fmt, case EINTR: zfs_verror(hdl, EZFS_INTR, fmt, ap); return (-1); + + case ECKSUM: + zfs_verror(hdl, EZFS_CKSUM, fmt, ap); + return (-1); } return (0);