Page MenuHomeFreeBSD

loader: return errors from writing ZFS labels
ClosedPublic

Authored by imp on Feb 22 2024, 12:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 10, 10:23 PM
Unknown Object (File)
Fri, May 10, 10:23 PM
Unknown Object (File)
Thu, May 9, 10:10 PM
Unknown Object (File)
Thu, May 9, 8:38 PM
Unknown Object (File)
Apr 21 2024, 6:07 AM
Unknown Object (File)
Apr 21 2024, 6:07 AM
Unknown Object (File)
Apr 21 2024, 6:07 AM
Unknown Object (File)
Apr 19 2024, 4:26 PM

Details

Summary

This can only return success. but we want to rerurn the last wrror.
this masked kboot's inability to write.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.Feb 22 2024, 12:14 AM
This revision was not accepted when it landed; it landed in state Needs Review.Feb 22 2024, 4:32 PM
This revision was automatically updated to reflect the committed changes.

Not sure if this is the right place to comment, but I saw this linked from https://code.illumos.org/c/illumos-gate/+/3328. There is indeed a bug in the original (a nonzero error code can be overwritten with zero) but it's been replaced with a different bug (a nonzero error code will never be returned..)

stand/libsa/zfs/zfsimpl.c
1691

I'm trying to figure out how this is supposed to work; we set rv to 0 above, and then only set it to rc if it is nonzero?

did you perhaps mean:

if (rc != 0) rv = rc;

(get return code of last failure)

or

if ((rc != 0) && (rv == 0)) rv = rc;

(get return code of first failure)?

stand/libsa/zfs/zfsimpl.c
1691

I read this backwards. rc and rv are terrible variables. The real fix is to change them all to something else. Or at least rc to something that doesn't look like rv.

I'd wanted 'if (rc != 0) rv = rc' to return the last error.

stand/libsa/zfs/zfsimpl.c
1691

https://reviews.freebsd.org/D44095
Do you want your email address in the reported by?

stand/libsa/zfs/zfsimpl.c
1691

https://reviews.freebsd.org/D44095
Do you want your email address in the reported by?

Yes, thank you. sommerfeld@hamachi.org