Skip to content
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

Handle ECKSUM as new EZFS_CKSUM ‒ "insufficient replicas" #13898

Merged
merged 1 commit into from Sep 16, 2022

Conversation

nabijaczleweli
Copy link
Contributor

Motivation and Context

#13808

How Has This Been Tested?

Given:

diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
index eea388cf3..717e9a94c 100644
--- a/lib/libzfs/libzfs_pool.c
+++ b/lib/libzfs/libzfs_pool.c
@@ -2053,6 +2053,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
                zcmd_expand_dst_nvlist(hdl, &zc);
        if (ret != 0)
                error = errno;
+       error = errno = ECKSUM;

        (void) zcmd_read_dst_nvlist(hdl, &zc, &nv);

I got

# ./zpool import -d /tmp pl
cannot import 'pl': insufficient replicas
        Destroy and re-create the pool from
        a backup source.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the OpenZFS code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes. – none apply(?)
  • I have run the ZFS Test Suite with this change applied. – Ci take my hand
  • All commit messages are properly formatted and contain Signed-off-by.

Closes openzfs#13808
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
@ryao
Copy link
Contributor

ryao commented Sep 15, 2022

This also closes #6805. That said, this looks good to me. Feel free to add my reviewed-by.

@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Sep 15, 2022

My first thought was to make it

typedef enum zfs_error {
	EZFS_SUCCESS = 0,	/* no error -- success */
	EZFS_CKSUM = ECKSUM,		/* insufficient replicas */
	EZFS_NOMEM = 2000,	/* out of memory */

and I think that's better but idk if that's valid ideologically, esp. given that that's EINTEGRITY=97 on FreeBSD vs EBADE=52 under Linux?

@ryao
Copy link
Contributor

ryao commented Sep 15, 2022

My first thought was to make it

typedef enum zfs_error {
	EZFS_SUCCESS = 0,	/* no error -- success */
	EZFS_CKSUM = ECKSUM,		/* insufficient replicas */
	EZFS_NOMEM = 2000,	/* out of memory */

and I think that's better but idk if that's valid ideologically, esp. given that that's EINTEGRITY=97 on FreeBSD vs EBADE=52 under Linux?

It is fine the way you did it. The values of zfs_error do not need to match the system error code values.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Sep 15, 2022
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Sep 16, 2022
@behlendorf behlendorf merged commit 6c8e9f0 into openzfs:master Sep 16, 2022
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 27, 2022
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
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Oct 1, 2022
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
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Oct 1, 2022
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
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Oct 1, 2022
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
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Oct 1, 2022
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
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Oct 1, 2022
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
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Oct 1, 2022
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
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Nov 23, 2022
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
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Nov 30, 2022
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
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Dec 1, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants