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)
Tue, Oct 22, 9:47 AM
Unknown Object (File)
Tue, Oct 22, 9:47 AM
Unknown Object (File)
Tue, Oct 22, 9:46 AM
Unknown Object (File)
Tue, Oct 22, 9:35 AM
Unknown Object (File)
Sep 9 2024, 3:36 AM
Unknown Object (File)
Sep 6 2024, 12:55 AM
Unknown Object (File)
Aug 31 2024, 7:06 PM
Unknown Object (File)
Jun 13 2024, 4:02 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