Skip to content

Commit

Permalink
Handle ECKSUM as new EZFS_CKSUM ‒ "insufficient replicas"
Browse files Browse the repository at this point in the history
Add a meaningful error message for ECKSUM to common error messages.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#6805 
Closes openzfs#13808
Closes openzfs#13898
  • Loading branch information
nabijaczleweli authored and andrewc12 committed Oct 1, 2022
1 parent 76bdf87 commit 940519f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/libzfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ typedef enum zfs_error {
EZFS_REBUILDING, /* resilvering (sequential reconstrution) */
EZFS_VDEV_NOTSUP, /* ops not supported for this type of vdev */
EZFS_NOT_USER_NAMESPACE, /* a file is not a user namespace */
EZFS_CKSUM, /* insufficient replicas */
EZFS_UNKNOWN
} zfs_error_t;

Expand Down
6 changes: 6 additions & 0 deletions lib/libzfs/libzfs_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,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"));
Expand Down Expand Up @@ -395,6 +397,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);
Expand Down

0 comments on commit 940519f

Please sign in to comment.