1578 Commits
Author SHA1 Message Date
Ed Maste 79d491be21 Remove "All Rights Reserved" from FreeBSD Foundation copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder.
2026-10-15 13:07:36 -04:00
Ed Maste e959f2a7d8 ctf*: exit with error upon terminate()
The initial port of the CTF tools had a FreeBSD-specific patch to print
the termination message but exit with a 0 status, with a goal of getting
as much to build as possible and silently ignoring any issues.

We're now past the point where silently ignoring failures makes sense.
Any future issues need to be found and addressed.

PR:		276826
PR:		276930 [exp-run]
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43743
2026-10-09 14:23:42 -04:00
Mateusz Piotrowski b6a573aa77 dwatch(1): Use mdo(1) instead of sudo(8) when configured
Reviewed by:	dteske, olce
Approved by:	christos (mentor)
MFC after:	1 week
Sponsored by:	fme AG
Differential Revision:	https://reviews.freebsd.org/D60408
2026-10-07 16:43:49 +02:00
John Baldwin c907302c12 zstream: Downgrade -Watomic-alignment to a warning
Don't complain about unaligned atomic operations on i386.  This
same approach is already used for libspl.
2026-10-05 22:35:14 -04:00
Tony Hutter fc6ed86272 zfs: cherry-pick from openzfs/master (restore reverted commit)
zpool: Add zpool status -vv error ranges (#17864)

Add necessery change to libzfs/Makefile

(cherry picked from commit e903655c50)
2026-10-01 11:53:35 +02:00
Martin Matuska 6aef93facf Revert "zfs: add btree.c to libzfs"
This reverts commit b4fdb5c236.
2026-09-29 12:15:31 +02:00
Martin Matuska b4fdb5c236 zfs: add btree.c to libzfs
Fixes breakage from 34f9f5680 (openzfs/zfs@1f380a4f3)
2026-09-29 12:12:14 +02:00
Martin Matuska 34f9f5680c zfs: merge openzfs/zfs@1f380a4f3
Notable upstream pull request merges:
 #17864 e903655c5 zpool: Add zpool status -vv error ranges
 #18820 -multiple zdb: account pending DDT-log frees in leak detection
 #18884 -multiple zio_crypt: establish platform interface; rework common
                  code to use it
 #19010 -multiple zfs_namecheck: reject '.' and '..' before a snapshot or
                  bookmark
 #19031 994fb1703 Fix metaslab count assertion in metaslab_group_alloc()
                  for small vdevs
 #19093 f5b2fc8e2 zfs_ctldir: make .zfs/snapshot/<name> btime the snapshot
                  creation time
 #19097 2dece2a34 zstream: report invalid record context without assertions
 #19102 78f49e1dd vdev_disk: simplify alignment checks for linear ABDs
 #19108 -multiple Fix permanent errors misfiled into the scrub error log
 #19110 fa4bc4dec spa_errlog: don't let one unresolvable entry hide the
                  whole error log
 #19116 b6dde8a17 zio_crypt: free the key unwrap uios when decryption fails
 #19122 -multiple Fix dd_lock contention on space accounting
 #19126 c792317f2 Avoid dp_lock in the dirty space accounting
 #19131 7fd87803e Make the spa_config_lock reader fast path lockless
 #19137 a83d96835 libzfs: do not iterate snapshots for a mountpoint
                  changelist
 #19152 ccce78729 ZIO: Order a batch arrival against the hold it releases
 #19155 9d7260c9b Propagate vdev state change on probe failure
 #19157 946be3a33 FreeBSD: remove legacy ioctl support
 #19165 1d9c32c16 zpool: accept more redundant special and dedup vdevs
 #19167 638abd22a zfs_domount: fix vfs_t double-free on root setup failure

Obtained from:	OpenZFS
OpenZFS commit:	1f380a4f34
2026-09-29 09:25:39 +02:00
Martin Matuska 2f10ffc003 zfs: merge openzfs/zfs@02b5baf13
Notable upstream pull request merges:

 #18808 6d4ff3b4f Pool split leaks DTL spacemap objects
 #18844 0833cfd64 Decline Direct I/O reads on a file handle after a benign
                  verify failure
 #18853 39764eb06 Fix double free when cloning a block with a pending free
 #18901 51fe1fb84 dmu_send: a meta-dnode range does not start where an
                  object does
 #18903 904d4327f dmu_objset_open_impl: unregister prop callbacks on error
 #18906 e45640415 zdb: add detailed diagnostics for MOS leaks and spacemap
                  refs
 #18909 1b7143557 Keep a grown vdev from adopting an older pool's labels
 #18912 -multiple Defer destruction of a snapshot that a mount is holding
                  open
 #18921 33ae06bb6 ZIO: Batch vdev children completions
 #18940 7853c27eb ZIO: Batch lightweight ZIOs
 #18967 -multiple Speed up pool rewind and allow it to tolerate minor damage
 #18968 b0fff48dc arc: harness buf_hdr's anon state invariant checks
 #18969 b0da5c4ce dsl_crypt: validate every key change-key will rewrap
 #18974 b19fa7c97 log_spacemap: make zfs_log_sm_blksz tunable
 #18982 c878ee452 zstream: track and limit memory use
 #18991 a1261384a zstream: self-tuning queues
 #18992 fd639b075 zcp: support bookmarks in zfs.sync.destroy
 #18993 0498c554d vdev_disk_open: fix ENOENT retry & cleanup error handling
 #19003 5280a08f6 Write uberblocks only to vdevs used by the txg
 #19008 c47591d5d arc: apply arc_min tunables set before arc_init() has run
 #19016 cd578e518 dnode: fix heap-use-after-free in dnode_rele_and_unlock()
 #19017 b824f3116 zstd: declare __asan_*_memory_region() for user space
                  builds
 #19029 6860d1c2f DDT: Use proper size when calling kmem_free on
                  ddt_prune_entry_t
 #19041 aa26ca67b Do not complete a device removal that hit IO errors
 #19042 8e5bb1d4b Wait for the initialize and trim threads to exit
 #19051 ba524e0d7 zpool: things get messy with 0 columns
 #19053 69ef525a4 dsl_deadlist_space_range: use correct tree when summing
                  up space
 #19059 0ee8ea01b FreeBSD: use sys/abi_compat.h for time32_t
 #19062 e08bc2973 Skip interior dnode slots when receiving DRR_FREEOBJECTS
 #19066 92a3904af Wait for the txg that finished a scan to sync
 #19071 db07a5e0a dbuf: account dirty data for embedded writes
 #19072 1a8e51491 Fix self-deadlock when cloning a range within the same
                  file
 #19075 75bd31c28 L2ARC: do not feed a device while its rebuild is pending
 #19083 56e8d234b Stop the TRIM and initialize threads when a vdev goes
                  offline
 #19090 ab994acdd dmu: remove dmu_prealloc()
 #19092 61fbdf1a2 zfs: spa_sync_upgrades() should only take lock when needed

Obtained from:	OpenZFS
OpenZFS commit:	02b5baf13c
2026-09-14 14:37:46 +02:00
Warner Losh a259b98fa2 tests: skip gracefully when the tested binary's own package isn't installed
pkgbase splits programs and their tests into separate packages (e.g.
unifdef/yacc/indent/file2c -> toolchain, jail -> jail, etc), while their
tests always land in the generic tests package.  Installing just the
tests package therefore leaves these suites unable to find the binary
they exercise, and they fail confusingly instead of skipping.

Rather than force all packages to be installed for the tests package,
make the tests cope with the missing packages.  Add require.progs (or,
for TAP/PLAIN-style suites with no atf_set hook: TEST_METADATA
required_programs) for the binary under test in: bectl, certctl,
ctfconvert, dhclient, file2c, indent, ipfw, jail, lastcomm, mixer,
newsyslog, nvmecontrol, pfctl, praudit, sa, syslogd, tunefs, unifdef,
yacc, ztest.

I skipped adding data for all the binaries in the base runtime
package for simplicity.

Assisted-by:		Claude Code (Sonnet 5)
Sponsored by:		Netflix
Reviewed by:		ngie
Differential Revision:	https://reviews.freebsd.org/D58262
2026-09-10 23:42:25 -06:00
Siva Mahadevan 8e75ea59b0 libctf: remove unused variable
This fixes the build with gcc 16 after the changes
to -Wunused*[0].

[0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59537
2026-09-10 10:40:28 -04:00
Siva Mahadevan 60d78908f5 dtrace/tests: compile D sources at runtime on test target
Previously, we would precompile D test dependencies using the
host's dtrace, which unconditionally outputs ELF files in the
host's format. This breaks the cross-compile build with errors
like the following:

dtrace: failed to link script: incorrect ELF machine type for
object file: tst.usdt.pieo
--- usdt.o ---
*** Failed target: usdt.o

This patch moves compilation to runtime for all C-based testcases
that have a dependent D source file.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D59030
2026-09-02 14:18:01 -04:00
Martin Matuska 22649d4dba zfs: merge openzfs/zfs@84aa7e7e0
Notable upstream pull request merges:

 #16761 eb1738bcb FreeBSD: Enable Direct IO by default
 #16747 -multiple On-demand log-spacemap flush
 #18474 0d0eae2ab implement thorough scrub support (zpool scrub -t)
 #18562 6721ab981 Calling thread IO
 #18657 7ed1268d3 Fix race between device removal completion and pool export
 #18707 0d1f3b1c6 RAIDZ: Fix parity regeneration/check condition
 #18713 -multiple libzfs: fix key unload failure when unmounting an
                  encryption root
 #18714 d902eec64 Disconnect metaslab tracing from default builds
 #18716 e78fa488a zstream: multithreading
 #18718 6acb99cb1 Do not return ESTALE for open-unlinked files
 #18720 f607ef7e7 Fix insufficient locking in dedup verify
 #18722 -multiple snapdir: misc cleanups
 #18724 9bf75b4b1 Fix reads for blocks freed after being cloned
 #18725 9b7642df9 Harden recv record validation
 #18732 37f066e3c FreeBSD: Wire sha512 offload to the build
 #18736 -multiple Remove idmap/userns concept from core & FreeBSD platform
                  code
 #18742 d63f14057 libzutil: keep valid spare and l2cache paths on import
 #18749 f217627d4 Fix receive of split large blocks with a short trailing
                  chunk
 #18754 83bf40784 Use a single creation time for a recursive snapshot
 #18755 ebd9e2765 zstream: add "drop records" chain module
 #18763 7d565cdfa zfs bookmark: add recursive (-r) bookmark creation
 #18765 50557cc80 zpool initialize: add -z to write zeroes
 #18766 0467ba01c Add SECURITY.md policy filE
 #18773 ffde77051 Fix deduce_nblkptr for large dnodes on receive
 #18784 -multiple libzfs: clarify the raw incremental "IV set guid mismatch"
                  error
 #18793 9a02e53ad libzfs: don't abort receiving a raw encrypted send that
                  carries holds
 #18795 30426217b Rate limit Direct I/O verify zevents
 #18798 73b202451 Bound explicit user prefetch to a fraction of the ARC
 #18801 2a5331f8e Fix dmu_zfetch_prime() assuming a stream was created
 #18802 fb5fdefd8 libzfs: fallback VDEV_UPATH to VDEV_PATH for non-DM
                  devices
 #18809 bd2d87399 zdb: output refcounts from verify_spacemap_refcounts()
 #18811 5d530b8be ABD: Validate borrowed buffer length
 #18812 5d687a975 dbuf: use dirty record size for overridden writes
 #18819 -multiple ddt: fix refcount bypass and gang member leak for dedup
                  gang blocks
 #18821 87e2e4047 BRT: Implement partial bv_entcount writing
 #18822 -multiple dnode_sync: Relax constraint on indirect freeing - #18822
 #18827 d98fa72ca L2ARC: bound the rebuild by the write hand on a first
                  sweep
 #18831 90cdd9aef Batch object reallocation syncs in zfs receive
 #18833 466d90e15 zed: let autoexpand see capacity changes on partitioned
                  disks
 #18835 1ac3f2786 mmp: skip non-writeable vdevs during activity check
 #18838 a04c40138 DDT: Fix several bugs in pruning
 #18841 0bb41751f zpool export: return EBUSY when zvol minors are in use
 #18848 3020c18ca dmu_recv: Avoid potential null deref
 #18855 8cdd9b2b7 mmp: do not require writes to mirror legs the config
                  marks absent
 #18858 596c7a0ec Reduce dp_lock scope for MOS writes
 #18859 3ebf3ffc4 Predict and throttle buffers dirtied by the sync context
 #18860 -multiple Further parallelize block cloning
 #18865 412b17a29 Fix DMU bonus hold leak on I/O error
 #18867 b5bb1f816 Add missing checks to zfs_clone_range_replay()
 #18868 3df5b2e7f libzfs: String trimming should not operate out of bounds
 #18869 be62c5385 libzfs: Do not call munmap() when mmap() fails
 #18871 74e76f2d8 libzfs: don't truncate a resolved vdev path in
                  zpool_vdev_name()
 #18874 7312322b5 nvpair: Fix operator precedence
 #18883 3bd8cefdc libzfs: don't read a dataset handle after closing it in
                  resume send
 #18886 b4f70cb9e Fix negative time overflows in DDT pruning
 #18888 674b1ae5c DDT: Make ddt_zap_walk() use cursor _by_dnode functions
 #18889 fd1ae59c7 DDT: Skip DDT log lookups in ddt_prune_walk()
 #18892 -multiple zhack: add "mmp reclaim" to recover a pool stranded by MMP
 #18897 216de07d8 arc: fix race between arc_release() and arc_read_done()
 #18899 28afe8b08 CodeQL: Flag implicit compare-then-assign in branch
                  conditions
 #18917 0a79c039f arc: save on buf_hash_find() call at arc_read_done()
 #18920 7026d3335 Fix race condition in raidz expansion startup
 #18927 be55e01bc FreeBSD: Do not leak TSD zfs_geom_probe_vdev_key on errors
 #18928 5bd7d4466 scan: count skipped blocks as examined
 #18937 a5d678864 Allow pool import with corrupted spare/l2arc configs
 #18960 -multiple vdev_open: use calling credential to check for device
                  access
 #18961 acbcdd92c dmu_recv_begin_check: dsl_dataset_rele() should be called
                  on ds
 #18962 df3ff37fc dmu_redact_snap: Do proper cleanup on ENAMETOOLONG
 #18964 84aa7e7e0 libspl: consult ZFS_HOSTID on FreeBSD as well

Obtained from:	OpenZFS
OpenZFS commit:	84aa7e7e09
2026-08-24 21:54:22 +02:00
Mark Johnston 8710a12993 libdtrace: Fix up one more translator
Fixes:	d8bcb13b79 ("libdtrace: Fix up translators after struct in_conninfo changes")
2026-07-29 19:30:37 +00:00
Mark Johnston d8bcb13b79 libdtrace: Fix up translators after struct in_conninfo changes
Fixes:	698402f4f9 ("inpcb: declare struct in_conninfo as a single declaration")
2026-07-29 18:22:06 +00:00
Devin Teske 434283fda9 dwatch: add nine diagnostic modules; grow errno, io, proc, sched
Grow the module collection to answer, each with a single command, the
first questions asked when diagnosing a sick system: why is my
application stalling, where is the kernel fighting over locks, what
file could it not find, why is this process getting EPERM, what killed
my process, will that fatal signal actually leave a core behind, what
was my process stuck on, where is my kernel memory going, who is
creating or entering jails, is the network slow because TCP is
resending, how long did my thread wait to run, and is the disk itself
slow.  Every module keeps to the house style: invocation-name
overloading through hard links, predicate-only D with inline lookup
tables (no if-statements), and stable providers only (syscall, proc,
sched, io, dtmalloc, and the lockstat, vfs, priv, and mib SDT
providers), so the modules remain drop-in compatible with older
releases (the one documented exception is noted below).  No kernel
changes: new and extended profiles under cddl/usr.sbin/dwatch/libexec
plus one libdtrace inline table (priv.d).

slow (slow-fsync, slow-open, slow-read, slow-syscall, slow-write, or
any slow-NAME by new link) records syscall entry timestamps in
thread-local storage and prints, at return, any call whose latency
meets a threshold (DWATCH_SLOW_MS, default 100), naming the syscall,
the elapsed time to the microsecond, and any errno returned.  The bare
profile watches a curated set of filesystem-related calls expected to
be fast; slow-syscall watches everything; unrecognized invocation
names fall through to syscall::NAME:return with the matching entry
probe derived mechanically from the return probe list.

lock (lock-adaptive, lock-block, lock-lockmgr, lock-rw, lock-spin,
lock-sx, lock-thread) rides the dtrace_lockstat(4) block and spin
probes, printing the held-off thread (free from the standard event
tag), the holdoff duration, the lock class, the lo_name of the lock
through a single cast of arg0 to struct lock_object (the first member
of every kernel lock), and reader/writer intent on the probes that
report it.  Holdoffs shorter than DWATCH_LOCK_MS (default 1; 0 shows
everything) are suppressed.

namei (namei-enoent, namei-entry, namei-failure) records the pathname
at vfs:namei:lookup:entry and reports it with the result at return.
Unlike the vop_lookup profile, which reconstructs paths from the name
cache one component at a time, this sees the whole path exactly as the
process requested it.  namei-enoent hunts file-not-found storms -- the
single most common use of truss(1) -- without stopping the victim.

priv (priv-err, priv-ok) watches priv_check(9) verdicts, naming the
exact privilege denied -- something no syscall tracer can see, because
by the time EPERM surfaces the priv(9) value is gone.  The number is
decoded by priv_string[], a new libdtrace inline table in the errno.d
and signal.d tradition, mechanically generated from sys/priv.h (247
entries) and installed to /usr/lib/dtrace where dtrace(1) auto-loads
it; on older releases it is a drop-in file like the module itself.

coredump (coredump-top) watches for delivery of signals whose default
action produces a core, per the SIGPROP_CORE entries of the sigproptbl
in kern_sig.c, and renders a verdict the same way and in the same
order the kernel will decide it: ignored or caught per the target's
struct sigacts, then the coredump() gauntlet of kern.coredump,
kern.sugid_coredump vs P_SUGID, procctl(2) PROC_TRACE_CTL, and
RLIMIT_CORE -- the sysctl knobs read live through kernel globals.
Where a coredump-worthy signal will produce no core, the verdict says
precisely which policy ate it.  coredump-top maintains a cumulative
catalog of coredump-worthy signals by process and signal, refreshed
every 3 seconds in the style of systop; combine the event profile with
`-O cmd' to capture state as each event occurs.

hang (hang-top) pairs sched:::sleep with sched:::wakeup through a
tid-keyed timestamp array and prints, as each thread wakes, any sleep
that meets a threshold (DWATCH_HANG_MS, default 1000), naming the
sleeper in the details and the waker in the standard event tag.  This
is the blocking the slow module structurally cannot see: a syscall
that never returns never reports its latency, while hang reports the
moment the wait ends, with the full duration.  hang-top maintains a
cumulative catalog of long sleeps by process (count and maximum) in
the style of coredump-top.

jail (jail-attach, jail-get, jail-remove, jail-set) watches the jail
management plane -- jail(2), jail_set(2), jail_get(2), jail_attach(2),
and jail_remove(2) -- naming the operation, the jail id (taken from
the entry argument for attach/remove, from the return value for the
others), and any errno.  Complements the dwatch `-j jail' filter,
which scopes any profile to processes inside one jail; this watches
who manipulates jails, from any jail or none.

dtmalloc (dtmalloc-top, or any dtmalloc-NAME by new link) rides the
dtmalloc provider (one malloc and one free probe per malloc(9) type).
The event profile prints allocations and frees meeting a size
threshold (DWATCH_MALLOC_MIN, default 65536) -- who is allocating huge
kernel buffers.  dtmalloc-top maintains a running catalog of net bytes
and outstanding allocation balance by type, sorted by net bytes so
leak suspects rise: a type that climbs without bound while the system
is in steady state is the suspect.  The catalog reflects activity
since the watch began, and is honest about caches holding what they
allocate.

mib (tcp-retransmit, or any mib-NAME by new link) rides the
per-counter mib SDT probes of the network stack.  The tcp-retransmit
profile curates the counters that signal send-path congestion or loss
-- data packet retransmissions, unnecessary retransmissions,
retransmit timer expirations, and connections dropped by retransmit
exhaustion -- decoded through an inline description table, answering
"is this network slow because TCP is resending?" as events with
process context rather than netstat(1) deltas.  NB: the mib probes
exist only in kernels built with options KDTRACE_MIB_SDT (default in
-CURRENT via std.debug); the module documents this and dtrace(1)
refuses the script elsewhere, making the dependency self-announcing.

Four existing modules gain personalities.  proc grows
proc-signal-fatal, filtering signal-send to signals whose default
disposition terminates the receiver, most-notably including
kernel-generated SIGSEGV/SIGBUS/SIGILL/SIGFPE that no kill(2) watcher
will ever see.  errno now reads its invocation name: errno-NAME shows
only syscalls returning that errno, where NAME is a symbolic name from
errno.d or a number; links are installed for errno-EACCES,
errno-ECAPMODE, errno-ENOENT, errno-ENOTCAPABLE, and errno-EPERM (the
latter pairs covering capsicum(4) capability-mode violations), and any
other errno needs only a new link.  sched grows sched-latency,
recording a timestamp at sched:::enqueue keyed by tid and printing at
sched:::on-cpu any run-queue wait meeting a threshold (DWATCH_SCHED_MS,
default 10) -- the literal measurement of scheduler delay on a system
with idle CPU that still feels sluggish.  io grows io-slow, pairing
io:::start with io:::done through a bio-keyed timestamp array and
printing any request that meets a threshold (DWATCH_IO_MS, default
100), naming the device, command, size, and elapsed time; watched
against zvols and a pool's leaf vdevs this brackets where in a ZFS
stack the time is going, without touching unstable providers.

Document all of the above plus the DWATCH_HANG_MS, DWATCH_IO_MS,
DWATCH_LOCK_MS, DWATCH_MALLOC_MIN, DWATCH_SCHED_MS, and DWATCH_SLOW_MS
knobs in dwatch(1).

All 46 new invocation names were exercised through `dwatch -d' with a
profile-path sandbox emulating the installed hard links: every one
sources cleanly and emits the intended D -- probe selection per alias,
entry/return and sleep/wakeup pairing through thread-local and global
associative arrays, threshold and mask predicates picking up their
knobs, aggregation clauses and printa column layout in the -top
profiles, multi-line predicate rendering, and `-t' correctly
displacing each module's default test were verified by inspection of
the generated scripts.  Invocations untouched by this pass generate D
identical to their previous output.  Modules pass sh -n, fit 80
columns, and dwatch.1 passes mandoc -Tlint with no new warnings.  A
validation harness performing a `dwatch -e' compile per profile
against the live kernel globs every staged profile for runs wherever
the dtrace device is present.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D58093
2026-07-28 16:32:57 -07:00
Bryan Drewery 6a6d6d7d9c dtrace tests: Fix finding multiple process results
When looking up self process we can use `ps -p $$` directly rather
than grep which may find other processes ending in the expected PID.

Sponsored by:	Dell Inc.
Reviewed by:	markj, vangyzen
Differential Revision: https://reviews.freebsd.org/D58019
2026-07-06 12:40:23 -07:00
Alexander Motin de6872045c zfs: fix SIMD defines to match OpenZFS HAVE_SIMD() macro
The OpenZFS merge 80aae8a3f8 introduced HAVE_SIMD() which checks for
HAVE_TOOLCHAIN_* defines via simd_config.h.  The kernel module Makefile
was updated, but kern.pre.mk (static kernel build) and the libzpool/libzfs
Makefiles were missed, still using the old HAVE_SSE2 etc. names.  This
caused all vectorized raidz, fletcher, and blake3 implementations to be
compiled out.
2026-07-01 13:09:49 -04:00
Alexander Ziaee 4f293e32e4 ctfmerge.1: Fix uniqlabel typos
The flag is -D, but it was written as a second -d. Add a period too.

MFC after:	3 days
2026-07-01 00:52:10 -04:00
Wolfram Schneider 32cf24b725 ctfmerge.1: Import ENVIRONMENT from NetBSD
Import the ENVIRONMENT section from NetBSD, minus the variable that our
ctfmerge does not have. Alphabetize them, polish grammar and alignment,
and add the variables to the man database. While here, remove whitespace
from the end of some lines to quiet linter.

MFC after:	3 days
PR:		291186
Co-authored-by:	Alexander Ziaee <[email protected]>
Obtained from:  NetBSD (christos <[email protected]>, 8a0c0d8)
Differential Revision:	https://reviews.freebsd.org/D54054
2026-06-30 09:42:59 -04:00
Martin Matuska d0b3ecdc27 zfs: merge openzfs/zfs@37af89948
Notable upstream pull request merges:
 #18509 f16b3744d zstream: refactor common functions
 #18573 -multiple Persist z_seq across znode eviction
 s18611 eb0c674c2 zfs_ioctl: fix EBUSY race between quota queries and mount
 #18637 77e64d86e Fix self-deadlock when setting the "allocating"/"path"
                  vdev property
 #18645 e3082b923 freebsd: set mnt_time on the rootfs at mountroot time
 #18652 50d012b2a zbookmark_compare: handle "marker" bookmarks with negative
                  levels
 #18664 520eeeaa6 Improve performance of "zpool offline" for log devices
 #18668 6b8f79877 Avoid more abd_t allocations in RAIDZ/dRAID
 #18669 99ab859c3 Optimize metaslab_set_selected_txg()
 #18673 97b9ba7a9 delegate: add 'send:encrypted' permission
 #18687 2ea519c2a Avoid lookup overhead for nonexistent xattr directories
 #18688 87593ea2b Fix handling of _PC_HAS_HIDDENSYSTEM for FreeBSD
 #18693 0483a8e0c Clean up embedded slog metaslab across txgs
 #18695 41311c665 RAIDZ: Optimize single data column writes
 #18706 37af89948 ddt_log: Fix refcount tagging for begin/commit

Obtained from:	OpenZFS
OpenZFS commit: 37af899488
2026-06-27 10:51:33 +02:00
Li-Wen Hsu 8e61d8707f libdtrace: Fix dt_print_sym() not printing symbols in non-oformat mode
dt_print_sym() fills the symbol string via snprintf() in non-oformat
mode but the guarding `dtp->dt_oformat != 0 &&` for the dt_printf()
call causes the symbol is computed but never emitted.

This fixes tests:

- common.profile-n.t_dtrace_contrib.tst_sym_ksh
- common.profile-n.t_dtrace_contrib.tst_func_ksh

Reviewed by:	markj
Fixes:		93f27766a7 ("dtrace: Add the 'oformat' libdtrace option")
MFC after:	3 days
Event:		Halifax Hackathon 202606
Location:	Room 208, Computer Science Building, Dalhousie University
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57895
2026-06-26 23:26:05 -03:00
Alexander Motin 6aaaf7ba4b 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.
2026-06-25 15:34:43 -04:00
Martin Matuska d949721745 zfs: merge openzfs/zfs@a170134fe
Notable upstream pull request merges:
 #18372 eaaea55b6 Consistently encode DRR_BEGIN packed nvlist payloads with
                  NV_ENCODE_XDR
 #18410 891e379d0 Fix failfast default and usage
 #18470 a2d053329 zdb: Add some more file layout output, triggered by -v
 #18472 d50f5b6d0 dsl_dir: avoid dd_lock during snapshots_changed updates
 #18493 d65015938 Vdev allocation bias/class change
 #18497 8fdc86675 zfs: annotate nested dd_lock in reservation sync
                  accounting
 #18494 956deba27 zdb: detect BRT and DDT leaks during block traversal
 #18499 c7cfe0805 zarcstat: detect attached L2ARC device with no data
 #18503 439b802e7 sa: fix sa_add_projid lock ordering
 #18508 968f4db03 zpool-attach.8: add EXAMPLES section
 #18513 45dddc452 zfs.4: Fix documentation of zfs_arc_dnode_reduce_percent
 #18516 8ff64005a zap: split implementation out into more files
 #18520 181e1b522 Fix double free for blocks cloned after DDT prune
 #18535 -multiple zstream: fix crashes when refcount tracking enabled
 #18536 -multiple refcount tag fixups
 #18541 a65ed7afd zpool/zfs: accept --help and -? after a subcommand
 #18544 6fb72fda0 zio_ddt_write: compute have_dvas after taking dde_io_lock
 #18546 -multiple zap: internal locking uplift
 #18550 40a87651d zap_impl: use flex array field for mzap_phys_t.mz_chunks
 #18551 -multiple zap: make the _by_dnode() op variants be the primary
                  implementation
 #18570 112b0131b zpl_xattr: stop heap-allocating prefixed xattr names
 #18578 4bc8c39b6 zed: Prefer dRAID distributed spares to regular ones
 #18596 e30ab5fa4 FreeBSD: Make it possible to build openzfs.ko with
                  sanitizers
 #18597 472ddca11 zed: Prefer spares with matching rotational and size
 #18599 c90dc2808 enforce exact decompressed length for lz4, gzip, and zstd
 #18603 -multiple zap: add zap_cursor_init_by_dnode; cursor unit tests;
                  mock dnode refcounts
 #18604 59dc88602 nvpair: Check for un-terminated strings in packed nvlist
 #18606 ef6f26145 When reading a vdev label skip libzfs_core_init()
 #18613 0aa4088dc sharenfs: Check for invalid characters
 #18615 80fb85b80 Fix the integer type in zfs_ioc_userspace_many()
 #18616 e199f6d98 Fix uninitialized variable warning in vdev_prop_get()
 #18617 7de42602c Extend dataset zfs_ioc_set_prop() secpolicy
 #18622 5fea0c838 Parallelize metaslab_sync_done() calls
 #18623 cab50d5ad Add additional verification of size fields and strings
 #18630 -multiple zap: misc function removal / uplift / tests
 #18633 a8ef128da Fix uninitialized variable warning in zil_parse()

Obtained from:	OpenZFS
OpenZFS commit:	a170134feb
2026-06-06 22:48:32 +02:00
Mateusz Piotrowski 03bc95b060 dtrace_dtmalloc.4: Document the DTrace dtmalloc provider
MFC after:	1 week
Discussed with:	christos, markj, ziaee
Differential Revision:	https://reviews.freebsd.org/D51396
2026-05-12 20:03:11 +02:00
Mateusz Piotrowski ef19cae253 dtrace_mib.4: Document the DTrace MIB provider
Reviewed by:	kp
MFC after:	1 week
Obtained from:	60d8dbbef0 netinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters
Differential Revision:	https://reviews.freebsd.org/D53709
2026-05-07 13:53:50 +02:00
Mateusz Piotrowski 242050278a dtrace: Document the syscall provider
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56831
2026-05-07 11:57:03 +02:00
Ryan Libby 050b3ff753 libzpool: force inlining of xxhash after removing xxhash.c
libzpool had a number of undefined symbols related to xxhash after
xxhash.c was removed from the build.

Fixes:	8a62a2a565 ("zfs: merge openzfs/zfs@f8e5af53e")
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D56770
2026-05-02 13:01:10 -07:00
Lexi Winter 036ff38ebd libzpool: Set -Wno-error=typedef-redefinition for clang
In some versions of LLVM (at least 21), the <*intrin.h> headers contain
unguarded duplicate typedefs; this isn't permitted prior to C11, and
libzpool is built as C99.  FreeBSD's LLVM backported LLVM PR #153820
to fix this, but other versions of LLVM (e.g., upstream, or on Linux)
don't have the patch, so this breaks the build.

Add -Wno-error=typedef-redefinition to downgrade this from an error
to a warning.

MFC after:	2 weeks
Reviewed by:	dim, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D56653
2026-04-27 22:31:47 +01:00
Bjoern A. Zeeb 93d301d95a Remove -fms-extensions throughout the tree
During a discussion about using -fms-extensions jhb pointed out that
we have them enabled in the kernel for gcc by default (even multiple
times in one part). I had missed all that and clang still failed on
my use case (needing another option).

The original cause for enabling them for our tree back then was that
we needed to support C11 anonymous struct/unions.
Our in-tree gcc 4.2.1, despite later patches, needed the
-fms-extensions to support these even though this was not the expected
use case for that option ( cc4a90c445 enabled it globally for the
kernel).
clang at that time (or at least when it became default for 10.0)
already was fine (with C11).

Any later gcc (4.6.0 onwards) did not need that option anymore, even
when compiled for -std=iso9899:1990 (which does not support anonymous
structs/unions) unless one would add -pedantic (see gcc git 4bdd0a60b27a).
This is also the reason why userland cddl sources now compile with the
option removed despite CSTD=c99.

The only driver which needed the option recently was ccp, but that was
fixed in 8d3f41dbcb by jhb.

So cleanup all uses cases of -fms-extensions for the moment as they are
no longer needed given all compilers currently supported seem to be
fine without them and gcc-4.2.1 was removed from the tree in stable/13
in 2020 (a9854bc381).

Reported by:	jhb (all this but possibly the world CDDL parts)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste (earlier), imp, jhb, glebius
Differential Revision: https://reviews.freebsd.org/D55072
2026-04-24 20:36:15 +00:00
Mateusz Piotrowski 2eb0a88891 dtrace.1: Reference dtrace_cam.4
Fixes:	1a7151f796 cam: Add probes for xpt actions
Event:	AsiaBSDCon 2026
2026-03-20 13:10:59 +08:00
Martin Matuska 80aae8a3f8 zfs: merge openzfs/zfs@3ee08abd2
Notable upstream pull request merges:
 #17000 -multiple cmd/zfs: support creating parents with canmount=no
 #17926 b481a8bbb Make zpool status dedup table support raw bytes -p output
 #18238 -multiple Report space metrics per allocation class
 #18240 5dad9459d Add --no-preserve-encryption flag
 #18257 1eace5906 libzfs: use mount_setattr for selective remount including
                  legacy mounts
 #18259 1e2c94a04 More consistent use of TREE_* macros in AVL comparators
 #18262 c58b8b7dc Fix check for .cfi_negate_ra_state on aarch64
 #18264 f109c7bb9 Add the --file-layout (-f) option to zdb(8)
 #18268 304de7f19 libzfs: handle EDOM error in zpool_create
 #18275 753f1e1e2 zstream: add a drop_record subcommand
 #18276 0f90a797d Fix vdev_rebuild_range() tx commit
 #18277 1e1d64d66 Fix log vdev removal issues
 #18278 06b0abfe6 Fix the send --exclude option to work with encryption
 #18281 e73ada771 libzpool: lift zfs_file ops out to separate source file
 #18284 d97945776 zstream: consolidate shared code
 #18285 -multiple Separate SIMD compile checks for userspace and kernel
 #18288 c5905b2cb Implement lzc_send_progress
 #18289 -multiple L2ARC: Add depth cap and write budget fairness for
                  persistent markers
 #18290 d45c8d648 FreeBSD: Improve dmesg kernel message prefix
 #18294 b403040c4 draid: fix data corruption after disk clear
 #18296 -multiple libzfs: mnttab cleanup
 #18300 d35951b18 zpool clear: remove undocumented rewind flags
 #18301 ae7fcd5f9 fix libzfs diff mem leak in an error path
 #18303 65165df12 zilstat: add man page
 #18314 7f65e04ab libzfs: scrub: only include start and end nv pairs if
                  needed for scrub
 #18315 -multiple Sync ZVOLs block cloning conditions with file systems
 #18330 f80338fac zarcsummary: add man page
 #18337 f259a47c7 zpool-iostat.8: clarify first report shows per-second
                  averages

Obtained from:	OpenZFS
OpenZFS commit:	3ee08abd2f
2026-03-19 21:25:34 +01:00
Martin Matuska 8a62a2a565 zfs: merge openzfs/zfs@f8e5af53e
Notable upstream pull request merges:
 #17358 4975430cf Add vdev property to disable vdev scheduler
 #18031 c77f17b75 Add snapshots_changed_nsecs dataset property
 #18080 dbb3f247e cmd/zfs: clone: accept `-u` to not mount newly created
                  datasets
 #18089 -multiple Zstd: Update bundled library to version 1.5.7
 #18091 2301755df Fix zfs_open() to skip zil_async_to_sync() for the
                  snapshot
 #18093 -multiple L2ARC: Rework write throttling with DWPD rate limiting
                  and parallel writes
 #18095 2dbd6af5e Rename several printf attributes declarations to
                  __printf__
 #18096 8605bdfdd FreeBSD: unbreak compilation on i386
 #18105 794f1587d When receiving a stream with the large block flag,
                  activate feature
 #18115 765929cb4 DDT: Add locking for table ZAP destruction
 #18118 09e4e01e9 Fix history logging for `zpool create -t`
 #18119 2f1f25217 icp: emit .note.GNU-stack section for all ELF targets
 #18131 3fffe4e70 Fix --enable-invariants on FreeBSD
 #18133 d2f5cb3a5 Move range_tree, btree, highbit64 to common code
 #18136 54b141fab FreeBSD: Remove references to DEBUG_VFS_LOCKS
 #18138 cdf89f413 Flush RRD only when TXGs contain data
 #18139 a157ef62a Make sure we can still write data to txg
 #18140 cd895f0e5 remove thread unsafe debug code causing FreeBSD double
                  free panic
 #18144 4f180e095 Fix activating large_microzap on receive
 #18146 35b2d3970 Lock db_mtx around arc_release() in couple places
 #18154 b36472052 nvpair: chase FreeBSD xdrproc_t definition
 #18160 21bbe7cb6 Improve caching for dbuf prefetches
 #18177 -multiple Multihost Improvements
 #18179 2646bd558 Allow rewrite skip cloned and snapshotted blocks
 #18180 aa29455dd Restrict cloning with different properties
 #18184 040ba7a7c libzfs: improve error message for zpool create with
                  ENXIO
 #18188 1412bdc6c zfs_vnops_os.c: Move a vput() to after
                  zfs_setattr_dir()
 #18198 cc184fe98 Fix `send:raw` permission for send `-w -I`
 #18208 ba970eb20 Cleanup allocation class selection
 #18212 0f9564e85 Simplify dnode_level_is_l2cacheable()
 #18214 370570890 Remove parent ZIO from dbuf_prefetch()
 #18218 bfb276e55 freebsd: Fix TIMESPEC_OVERFLOW for PowerPC
 #18222 d06a1d9ac Fix available space accounting for special/dedup
 #18225 d48967728 ICP: AES-GCM VAES-AVX2: fix typos and document
                  source files
 #18226 c8a72a27e ICP: AES-GCM assembly: remove unused Gmul functions
 #18230 -multiple Fix zdb --key crash for unencrypted datasets, and
                  teach tests to understand this better
 #18233 -multiple icp: add SHA-512 implementation using Intel SHA512
                  extension
 #18245 991fc56fa Introduce dedupused/dedupsaved pool properties
 #18251 6a717f31e Improve misleading error messages for
                 ZPOOL_STATUS_CORRUPT_POOL
 #18254 7744f0496 SIMD: libspl: test the correct CPUID bit for AVX512VL
 #18255 6495dafd5 range_tree: use zfs_panic_recover() for
                  partial-overlap remov
 #18256 3408332d7 zhack: Fix importing large allocation profiles on
                  small pools
 #18258 f8457fbdc Fix deadlock on dmu_tx_assign() from vdev_rebuild()
 #18263 f8e5af53e Fix redundant declaration of dsl_pool_t

Obtained from:	OpenZFS
OpenZFS commit:	f8e5af53e9
2026-03-14 13:14:56 +01:00
Minsoo Choo 94d1731e73 Makefile*: remove powerpcspe
As reported on the freebsd-announce mailing list[1] FreeBSD is
continuing to retire 32-bit support.  Remove powerpcspe from build
infrastructure.

[1] https://lists.freebsd.org/archives/freebsd-announce/2024-February/000117.html

Signed-off-by: Minsoo Choo <[email protected]>
Reviewed by:	jhibbits, emaste
Pull request:	https://github.com/freebsd/freebsd-src/pull/1914
2026-01-09 11:28:43 -05:00
Warner Losh efb77950fd dtrace: Add definitiosn for the cam dtrace provider
Sponsored by:		Netflix
Reviewed by:		adrian
Differential Revision:	https://reviews.freebsd.org/D54471
2026-01-07 23:20:28 -07:00
Martin Matuska 2f6c77cd6f zfs: unbreak build after 89f729dcc merge
Link zfsd against spl and pthread
2025-12-08 13:21:26 +01:00
Martin Matuska 8b78d412ae zfs: world changes after 89f729dcc merge
Remove, unbind and obsolete libuutil and libtpool
Update zfs_configh and zfs_gitrev.h
2025-12-07 23:09:12 +01:00
Mark Peek 732b4aa05d ctfmerge: fix segfault when building on macOS
The barrier code was using semaphores which have been deprecated in
macOS and not working at all, causing a race condition. Since macOS
does not have pthread_barrier_*(), this change uses a condition
variable instead.

PR:		290958
Reported by:	wosch
MFC after:	2 weeks
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D54018
2025-12-01 12:50:24 -08:00
Mark Johnston 17fd7780fb dtrace tests: Update names after the syscall::exit probe was renamed
MFC after:	1 week
Fixes:	e7e964cb2e ("syscalls: normalize _exit(2) declerations")
2025-12-01 14:20:06 +00:00
Minsoo Choo 507cfc4279 dtrace.1: remove sparc
Signed-off-by: Minsoo Choo <[email protected]>

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1907
2025-12-01 14:19:19 +00:00
Minsoo Choo d11ff7f933 opensolaris: remove references to sparc
Signed-off-by: Minsoo Choo <[email protected]>

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1907
2025-12-01 14:19:19 +00:00
Minsoo Choo dfd35cd244 libdtrace: remove sparc code
Signed-off-by: Minsoo Choo <[email protected]>

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1907
2025-12-01 14:19:19 +00:00
Minsoo Choo d667cc77ba dtrace: remove sparc tests
Signed-off-by: Minsoo Choo <[email protected]>

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1907
2025-12-01 14:19:18 +00:00
John Baldwin e928afc531 Use ZFSTOP more broadly
Reviewed by:	brooks
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D53791
2025-11-24 10:47:10 -05:00
John Baldwin 7980cf5d6f Centralize definition of ZFSTOP
Define this helper variable in one place and make it available while
building the entire base system.

Reviewed by:	sjg
Obtained from:	CheriBSD (mostly)
Differential Revision:	https://reviews.freebsd.org/D53790
2025-11-24 10:46:56 -05:00
Martin Matuska bb8580e7a6 zfs: fix cross-build after openzfs/zfs@e63d026b9d
Workaround multiple cross-build issues in OpenZFS code

TBD: discuss long-term fix with OpenZFS
2025-11-17 17:12:03 +01:00
Martin Matuska 4303bde429 zfs: fix build after openzfs/zfs@e63d026b9
Fix Makefiles
Update zfs_config.h and zfs_gitrev.h
2025-11-17 17:11:56 +01:00
Mateusz Piotrowski 7bcd3a04c8 dtrace_priv.4: Document the DTrace priv provider
Fixes:	6efcc2f26a Add static tracing for privilege checking
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D53630
2025-11-12 15:51:37 +01:00
Mateusz Piotrowski f811c0a555 dtrace.1: Document DTRACE_DEBUG
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53627
2025-11-08 11:28:47 +01:00
Mateusz Piotrowski 753cef701d dtrace.1: Fix mdoc macros around -x
There should be no space between -x's "arg" and "=value".

MFC after:	3 days
2025-11-07 00:04:01 +01:00