Page MenuHomeFreeBSD

Map ECKSUM and EFRAGS from ZFS onto real errnos
ClosedPublic

Authored by freqlabs on Dec 30 2019, 9:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 10 2024, 1:37 AM
Unknown Object (File)
Aug 24 2023, 12:28 PM
Unknown Object (File)
Jul 1 2023, 11:15 PM
Unknown Object (File)
Jun 16 2023, 3:26 AM
Unknown Object (File)
Jun 3 2023, 8:09 AM
Unknown Object (File)
May 9 2023, 7:51 PM
Subscribers

Details

Summary

Make it less confusing when, for example, stat sets errno to 122 because a checksum failed in ZFS:

Before: getfacl: /foo/bar: stat() failed: Unknown error: 122
After: getfacl: /foo/bar: stat() failed: Integrity check failed

Sponsored by: iXsystems, Inc.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mckusick requested changes to this revision.Jan 6 2020, 9:01 PM

Adding a new error number requires changes to a lot more files than just lib/libc/gen/errlst.c. See for example -r343111 when I added EINTEGRITY which touched 16 different files in the system. And that is just to add the base error. It then has to be added to every system call manual page for which it can be returned.

The easier way to fix this problem is to map ZFS specific errors to existing errors in FreeBSD. In this case, I would map ECKSUM to EINTEGRITY and assuming that EFRAGS is returned when a write fails due to lack of ability to store it, I would map it to ENOSPC.

This revision now requires changes to proceed.Jan 6 2020, 9:01 PM
freqlabs retitled this revision from Add error strings for ECKSUM and EFRAGS from ZFS to Map ECKSUM and EFRAGS from ZFS onto real errnos.
freqlabs edited the summary of this revision. (Show Details)
freqlabs added a reviewer: mav.

Incorporate feedback. Map the constants to existing errnos instead of adding messages for old numbers.

EFRAGS seems not to be really used on FreeBSD. It is mentioned once in code, but it seems to be dead from the day one -- used on Illumos to support dumping to ZVOL. I am not sure why ZoL haven't dropped it yet.
About ECKSUM->EINTEGRITY I have no objections, other then Linux maps it into some nonsense, so some applications may get surprised if notice the difference. But that may be unavoidable.

I agree with mac@ that it looks like EFRAGS is only in an unused code path. But it does not hurt to map it to a FreeBSD error in the event that the code path gets brought back to life.

I suggest that you add a comment above the new defines that explain that they map ZFS errors to their closest equivalent FreeBSD errors.

Add a comment explaining the motivation for the mapping.

This revision is now accepted and ready to land.Jan 13 2020, 12:52 AM
This revision was automatically updated to reflect the committed changes.

@mckusick I would like to MFC your EINTEGRITY change to stable/12 along with this change. Does this seem reasonable? At a glance the only merge conflict is that stable/12 doesn't have contrib/libc++, so that part of the patch would be dropped. Anything else to look out for?
Thanks in advance!

After consulting with kib@ I have concluded that it is acceptable to MFC -r343111 to stable/12. You should MFC your change separately (i.e., in a second checkin).