Page MenuHomeFreeBSD

reboot: Implement zfs support
ClosedPublic

Authored by imp on Feb 10 2024, 7:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 8:05 PM
Unknown Object (File)
Fri, Nov 15, 7:20 PM
Unknown Object (File)
Fri, Nov 15, 4:15 PM
Unknown Object (File)
Fri, Nov 8, 1:24 AM
Unknown Object (File)
Nov 1 2024, 4:32 AM
Unknown Object (File)
Oct 21 2024, 1:24 AM
Unknown Object (File)
Oct 21 2024, 1:18 AM
Unknown Object (File)
Oct 21 2024, 1:18 AM
Subscribers

Details

Summary

Implement full support for ZFS -k support. For ZFS, we have to set a
property that gets cleared by the boot loaeder for whether or not to
process nextboot.conf. Do this using system("zfsbootcfg..." rather than
coding the small subset of that program inline to avoid CDDL
contamination of reboot and the complications of disabling CDDL and/or
ZFS. The few bytes needed to implement reboot for systems with zfs is
not worth saving for systems w/o ZFS.

Only set nextboot_enable=YES for UFS filesystems. They are the only one
that need that as the first line. Its presence on ZFS can cause the
kernel to not be oneshot.

Sponsored by: Netflix

Test Plan

This leaves just -o and -e from the nextboot shell script, which isn't as careful as reboot, to be implemented.
I plan on replacing the nextboot.sh script with a symlink and different behavior (not actually rebooting).
It's the lessor of the evils of having our nextboot protocol in multiple places, and continuing support for it in reboot.
The extra code is small (< 2k) and having it all together eventually is good.
Though Kyle did mention a libnextboot, I didn't take that next step because nothing else knows about this protocol from this side of the fence (of course the loader knows...).

Diff Detail

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

Event Timeline

imp requested review of this revision.Feb 10 2024, 7:48 PM
imp created this revision.
imp added reviewers: kevans, allanjude, kib, emaste, jhb.
imp edited the test plan for this revision. (Show Details)

rebase /refresh

This revision is now accepted and ready to land.Feb 11 2024, 7:22 AM
markj added inline comments.
sbin/reboot/reboot.c
80

Why not invoke nextboot(8) directly? It looks like a lot of this code is reimplementing its functionality.

sbin/reboot/reboot.c
80

Because I'm eliminating the shell script so it's only implemented in one place.

sbin/reboot/reboot.c
80

... and so there's better error handling... Plus building the command line with all the proper arguments was harder than just pulling the relevant bits inline.

sbin/reboot/reboot.c
80

I see now, sorry. Sometimes it's hard to see the overarching goal of a patch series in phabricator, there's no really good place to summarize the full series.

This revision was automatically updated to reflect the committed changes.