zfsd: Improve spare selection
Port OpenZFS PRs #18597 and #18578 from zed to zfsd.
When activating a spare, sort candidates before trying them:
1. Distributed dRAID spare matching the failed vdev's group (fastest
rebuild via sequential resilver)
2. Regular spares
3. Non-matching distributed spares (kernel will reject anyway)
4. Within each tier: prefer rotational match, then smallest
sufficient size
Also try all healthy spares in order rather than stopping at the
first one, and use sequential rebuild for distributed spares.
bhyve: Use a blocking socket in the helper process
The send_packet callback does not handle EAGAIN, and on the recv side we
already use poll() and MSG_DONTWAIT to implement a non-blocking loop.
PR: 291616
Tested by: novel
Fixes: 0e62ebd20172 ("bhyve: Move the slirp backend out into a separate process")
Differential Revision: https://reviews.freebsd.org/D54340
(cherry picked from commit daef625cf884dea33d50ad7a0e2da0879a442495)
bhyve/slirp: Drop privileges before entering capability mode
When in restricted mode, the slirp-helper process enters a capsicum
sandbox, after which we cannot look up the uid for the "nobody" user.
Reverse the order.
Reported by: kp
Fixes: 0e62ebd20172 ("bhyve: Move the slirp backend out into a separate process")
(cherry picked from commit b0c7eaf83d21bbc333e247ab9e136965b3ca54ed)
divert: Avoid using atomic_(load|store)_(acq|rel)_16
It's not implemented on some arches. Use a plain int to count the
number of sockets in a divert lbgroup.
Reported by: Jenkins
Fixes: 895a0ae67fe2 ("divert: Define semantics for SO_REUSEPORT_LB on divert sockets")
(cherry picked from commit c564074c9aaa8a3f9273de3cb802edcb3e2e2a40)
divert: Define semantics for SO_REUSEPORT_LB on divert sockets
Allow SO_REUSEPORT_LB to be set on divert sockets. If set, then bind()
will add the socket to a "load-balancing group". When a divert-to rule
matches a port with an associated group, the corresponding state ID is
used to select a specific socket from the group. Packets without an
associated state are simply forwarded to the first socket in the group.
For now I only pass a state ID from pf, as I couldn't see a useful
identifier on the ipfw side.
This implementation is simple but has a caveat, that being that if
sockets are added to the group while flows are being processed, the size
of the group will change and this changes the mapping of state IDs to
sockets. So, to get a consistent mapping, the divert socket application
must bind all of its sockets before any traffic is diverted by the
firewall.
Reviewed by: glebius
MFC after: 1 month
[5 lines not shown]
arch.7: used title case for .Ss headings
Do capitalize "size". Don't gratutiously capitalize "char" any more
than we do "make" further down.
Reviewed by: emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D57820
Add kernel manpages for bcopy, memcpy, and memmove
We will add variants of memcpy and memmove to support CHERI so
bootstrap the manpages from section 3.
Mark bcopy as deprecated.
Reviewed by: imp, kib, emaste
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D57661
jail: clean up locking around do_jail_attach
jail_attach_jd passed PD_DEREF to do_jail_attach, assuming it would take
care of freeing the held prison. This is not true, as do_jail_attach
immediately cleared that flag, leaving the jail stock in dying state
when it is later removed.
Reported by: markj
Reviewed by: markj
MFC after: 3 days
Differential Revision: <https://reviews.freebsd.org/D57674>
kern: osd: trash a slot's methods upon deregistration
This both lets us quickly identify a slot that's been deallocated while
debugging, and forces us to take a fault if something tries to call one
of the methods anyways somehow with osd_destructors[slot - 1] == NULL.
Reviewed by: imp, jamie
Differential Revision: https://reviews.freebsd.org/D48075
kern: osd: abstract away the math for locating a slot method
It's relatively simple, but we'll do it a couple of times; pull it
out into a macro.
Reviewed by: imp (previous version), jamie
Differential Revision: https://reviews.freebsd.org/D48074
adduser: Normalize supplemental groups
Rather than insist on a space-separated list, normalize the input so
that any number of spaces, commas, colons, or semicolons are accepted.
Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D57774
fwcam: add IIDC 1394 FireWire camera driver
Add fwcam(4), a driver for IIDC v1.30 (TA Document 1999023) digital
cameras over IEEE 1394.
Supports Format_0 (VGA) video modes with isochronous receive DMA,
feature control (brightness, exposure, gain, shutter, white balance,
focus, etc.), poll/kqueue, and hot-plug via bus reset handling.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D57685
firewire: add shared helpers for ISO receive drivers
Add fw_helpers.h with common static inline helpers for FireWire ISO
receive drivers: async xfer wait with timeout and tlabel cleanup,
quadlet read/write, and ISO mbuf management.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D57684
hwpstate_intel(4): Fix error tests
How I failed to notice this during the review will remain a mistery.
Fixes: 29b8220b179b ("hwpstate_intel: Use ipi instead of thread_lock + sched_bind")
Event: Halifax Hackathon 202606
Location: jrm@'s bathroom
Sponsored by: The FreeBSD Foundation