OpenZFS/src a170134man/man4 zfs.4, module/os/freebsd/zfs sysctl_os.c

metaslab: expose df_alloc_threshold and df_free_pct on Linux

Expose metaslab_df_alloc_threshold and metaslab_df_free_pct as module
parameters on Linux, matching their existing FreeBSD sysctls.

Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18632
DeltaFile
+0-26module/os/freebsd/zfs/sysctl_os.c
+12-0man/man4/zfs.4
+8-0module/zfs/metaslab.c
+20-263 files

OpenZFS/src b35bf7etests/zfs-tests/tests/functional/cli_root/zpool_import zpool_import_parallel_pos.ksh

ZTS: relax zpool_import_parallel_pos.ksh timing

Occasionally in the CI this test will fail because the parallel import
took longer than half of the serial time (but still less than the full
serial time).  Increase the cutoff to 3/4 of the serial time to preserve
the intent yet try and avoid these false positive failures.

Reviewed-by: Chris Longros <chris.longros at gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18634
DeltaFile
+2-2tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_parallel_pos.ksh
+2-21 files

OpenZFS/src a8ef128module/zfs zil.c

Fix uninitialized variable warning in zil_parse()

This resolves the following possible uninitialized variable warning
when building with --enable-code-coverage and gcc 8.5.0.

    module/zfs/zil.c: In function ‘zil_parse’:
    module/zfs/zil.c:549:47: warning: ‘end’ may be used uninitialized
    in this function [-Wmaybe-uninitialized]

Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18633
DeltaFile
+1-1module/zfs/zil.c
+1-11 files

OpenZFS/src cf80080tests/unit test_zap.c

unit/zap: zap_value_search

Two separate tests, one for basic operation and one for the "value mask"
feature.

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+127-0tests/unit/test_zap.c
+127-01 files

OpenZFS/src 63fad34tests/unit unit.c unit.h

unit: rand helpers

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+20-0tests/unit/unit.c
+4-0tests/unit/unit.h
+24-02 files

OpenZFS/src 089a54finclude/sys zap.h, module/zfs zap.c

zap: add zap_value_search_by_dnode()

This operates entirely on a cursor, so the two entry points just
instantiate a new cursor and then pass it into the worker.

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+23-7module/zfs/zap.c
+2-0include/sys/zap.h
+25-72 files

OpenZFS/src c869c0ftests/unit test_zap.c

unit/zap: zap_*_int and zap_*_int_key

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+91-0tests/unit/test_zap.c
+91-01 files

OpenZFS/src 0ff134finclude/sys zap.h, module/zfs zap.c

zap: add _by_dnode() variants for int and int_key functions

These functions are far too simple to make wrapping worthwhile, so
instead we just lift the important shared bit - the value->string
conversion - into a small macro, and use it in all of them.

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+49-18module/zfs/zap.c
+11-0include/sys/zap.h
+60-182 files

OpenZFS/src fd70c22tests/unit test_zap.c

unit/zap: zap_increment

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+51-0tests/unit/test_zap.c
+51-01 files

OpenZFS/src 1266435include/sys zap.h, module/zfs zap.c

zap: add zap_increment_by_dnode()

Make consistent with the standard pattern, with zap_increment() becoming
a simple wrapper around zap_increment_by_dnode().

This has a small, likely unnoticeable, behaviour change. The previous
version didn't use the _by_dnode() functions, so the ZAP, dnode and dbuf
could theoretically be evicted between calls. With the dnode held across
the calls, this won't happen anymore. This is almost certainly a good
thing.

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+17-4module/zfs/zap.c
+2-0include/sys/zap.h
+19-42 files

OpenZFS/src 47b53fdinclude/sys zap.h, module/zfs zap.c

zap: remove zap_join() functions

These work, but are limited in their focus (single uint64_t key). The
last use anywhere was removed in d4a72f2386 (~2017). Better to remove
them rather than bother to uplift them to the new _by_dnode() structure.
They're simple to recreate if we ever do need them again.

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+0-84module/zfs/zap.c
+0-15include/sys/zap.h
+0-992 files

OpenZFS/src 9ff3fdfinclude/sys zap.h, module/zfs zap.c dmu_objset.c

zap: remove zap_increment_int()

This is a strange function that can't possibly work sensibly with
zap_add_int()/zap_remove_int()/zap_lookup_int(), as it allows the key
and value to diverge, which is not how these functions appear to work.

It would make more sense if it were called zap_increment_int_key(), as
that family can have divergent key and value. But it doesn't.

Fortunately, nothing uses it. There was a function named
zap_increment_int() in Sun ZFS, that was renamed to zap_increment()
early in ZoL's lifetime, and is unrelated.

So, remove it, and fix up some very old comments referring to it.

Sponsored-by: TrueNAS
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18630
DeltaFile
+0-11module/zfs/zap.c
+0-2include/sys/zap.h
+1-1module/zfs/dmu_objset.c
+1-143 files

OpenZFS/src cab50d5module/zfs dmu_recv.c zfs_quota.c

Add additional verification of size fields and strings (#18623)

- Check for size fields that convert to smaller integers.
- Explicitly terminate bootenv string.
- Initialize variables that could be returned in an error case.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Chris Longros <chris.longros at gmail.com>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #18623
DeltaFile
+31-13module/zfs/dmu_recv.c
+6-2module/zfs/zfs_quota.c
+1-1module/zfs/zfs_ioctl.c
+1-0module/zfs/vdev_label.c
+39-164 files

OpenZFS/src 6cc4492.github/workflows/scripts qemu-2-start.sh

CI: Add alternative URLs for CentOS stream

Fallback to trying the "CentOS Strean Composes" repo for the qcow2
images if the regular URLs fail.  The Composes repo contains the daily
autobuilt Stream images.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #18628
DeltaFile
+22-0.github/workflows/scripts/qemu-2-start.sh
+22-01 files

OpenZFS/src c4d0f3d.github/workflows/scripts qemu-6-tests.sh

CI: Increase default RCU stall timeout on Linux

When CONFIG_RCU_CPU_STALL_TIMEOUT is configured an RCU stall which
exceeds the default timeout will trigger an NMI and panic the VM.
Given the heavily virtualized nature of the CI environment we want
to make sure to only trigger this due to a real deadlock and not
due to over-subscription of the systems resources.  This timeout
normally defaults to 20-30 seconds and this change increases it
to 120 seconds.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18624
DeltaFile
+7-0.github/workflows/scripts/qemu-6-tests.sh
+7-01 files

OpenZFS/src cae1421.github/workflows codeql.yml

CI: Update CodeQL actions to v4

CodeQL Action v3 has been deprecated and will be retired
December 2026.  Update codeql.yml to use CodeQL Action v4
and update the runner to ubuntu-24.04.

Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18629
DeltaFile
+4-4.github/workflows/codeql.yml
+4-41 files

OpenZFS/src a851ba8.github/workflows codeql.yml

CI: Re-enable CodeQL workflows on push

This workflow was disabled 'on push' recently in commit 1916c2c5
to reduce redundant CI runs.  However, this check is fairly quick
and we want it run regularly against the branches.  Enable it.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18627
DeltaFile
+0-1.github/workflows/codeql.yml
+0-11 files

OpenZFS/src 2076569contrib/debian not-installed, etc Makefile.am

Remove /etc/sudoers.d/zfs

The smartctl exception in /etc/sudoers.d/zfs doesn't cover devices
like NVMe or symlinked devices.  Just get rid of it rather than
keep maintaining it.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #18626
DeltaFile
+0-9etc/sudoers.d/zfs
+0-6etc/Makefile.am
+1-4man/man8/zpool-iostat.8
+0-1contrib/debian/not-installed
+0-1rpm/generic/zfs.spec.in
+1-215 files

OpenZFS/src a65ed7acmd/zfs zfs_main.c, cmd/zpool zpool_main.c

zpool/zfs: accept --help and -? after a subcommand

Print the short usage instead of "invalid option".

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18541
DeltaFile
+12-0cmd/zfs/zfs_main.c
+12-0cmd/zpool/zpool_main.c
+24-02 files

OpenZFS/src 5fea0c8include/sys vdev_impl.h, module/zfs vdev.c spa.c

Parallelize metaslab_sync_done() calls

Some of our random write benchmarks on a fragmented pool show that
single-threaded portion of sync process (txg_sync_thread) can use
up to 45% of CPU time.  Most of it is consumed by metaslab_sync()
and metaslab_sync_done(), during which time the pool is not doing
anything else.

While metaslab_sync() is not trivial to parallelize due to having
single spacemap log, metaslab_sync_done() is doing only per-metaslab
accounting and they can run in parallel.  Even better, we can run
them while waiting for vdev label update and cache flush I/Os.

With this patch on my test system similar test randomly writing 12
100GB files with 4KB blocks shows IOPS increase from 176K to 220K.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18622
DeltaFile
+26-4module/zfs/vdev.c
+4-3module/zfs/spa.c
+1-0include/sys/vdev_impl.h
+31-73 files

OpenZFS/src e033759tests/unit README.md

unit: update docs for new coverage report options

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18619
DeltaFile
+49-25tests/unit/README.md
+49-251 files

OpenZFS/src 9a6dd0etests/unit Makefile.am

unit: support text & HTML targets; improve coverage rules

The main change is switching `unit-coverage` to run
scripts/coverage_report.pl, to get nice coverage summary output on the
commandline. The previous behaviour moves to `unit-coverage-html`.

Calls to lcov and genhtml are now silencing more warnings, and the
output file now gets branch coverage as well.

This should be compatible with both lcov 1.x and 2.x. It takes advantage
of the fact that 1.x is far more forgiving of both options it doesn't
understand, and of various kinds of "inconsistency" in the input data.

The rest is both simplifying and improving the rules. We keep the
coverage output around now, but still rebuild it if the binary changes.
The `clean` target now removes the coverage output too. And we use the
target name more often for building path names, as its far less noisy.

Sponsored-by: TrueNAS

    [3 lines not shown]
DeltaFile
+40-14tests/unit/Makefile.am
+40-141 files

OpenZFS/src 9f23793scripts coverage_report.pl Makefile.am

coverage_report: produce nice text reports from lcov/geninfo tracefiles

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18619
DeltaFile
+392-0scripts/coverage_report.pl
+1-0scripts/Makefile.am
+393-02 files

OpenZFS/src 4256f4fcontrib/pam_zfs_key pam_zfs_key.c

pam: use open fd instead of path

Instead of performing multiple operations on the path name in
zfs_key_config_modify_session_counter() open the file once and
perform the fchown, fchmod, and openat on the open file handle.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18618
DeltaFile
+21-8contrib/pam_zfs_key/pam_zfs_key.c
+21-81 files

OpenZFS/src 4eb0851tests/test-runner/bin zts-report.py.in, tests/zfs-tests/tests/functional/snapshot snapshot_002_pos.ksh snapshot_006_pos.ksh

ZTS: fix mktemp usage on FreeBSD

On FreeBSD -t takes a required prefix argument. Use
"mktemp -d $TEST_BASE_DIR/..." instead.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18621
DeltaFile
+0-2tests/test-runner/bin/zts-report.py.in
+1-1tests/zfs-tests/tests/functional/snapshot/snapshot_002_pos.ksh
+1-1tests/zfs-tests/tests/functional/snapshot/snapshot_006_pos.ksh
+1-1tests/zfs-tests/tests/functional/zvol/zvol_stress/zvol_stress.ksh
+3-54 files

OpenZFS/src 7de4260module/zfs zfs_ioctl.c

Extend dataset zfs_ioc_set_prop() secpolicy

When zc->zc_cookie is set this indicates to zfs_ioc_set_prop() that
these are received properties and ZPROP_HAS_RECVD will be set on the
dataset.  This is only done as part of a `zfs receive` so additionally
apply the zfs_secpolicy_recv() policy.  Individual property checks
continue to be handled by zfs_check_settable().

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18617
DeltaFile
+18-1module/zfs/zfs_ioctl.c
+18-11 files

OpenZFS/src e199f6dmodule/zfs vdev.c

Fix uninitialized variable warning in vdev_prop_get()

Update vdev_prop_get_objid() to set objid on error as the comment
in vdev_prop_get() describes.

    "objid is set to 0 when absent and the few cases that call
    zap_lookup directly guard against this below."

This resolves the following possible uninitialized variable warning.

    module/zfs/vdev.c: In function ‘vdev_prop_get’:
    module/zfs/vdev.c:6913:12: error: ‘objid’ may be used uninitialized
    in this function [-Werror=maybe-uninitialized]

Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18616
DeltaFile
+2-1module/zfs/vdev.c
+2-11 files

OpenZFS/src 0aa4088lib/libzfs libzfs_changelist.c libzfs_share.c

sharenfs: Check for invalid characters

Check for invalid characters in sharenfs/sharesmb dataset props.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #18613
DeltaFile
+12-3lib/libzfs/libzfs_changelist.c
+8-0lib/libzfs/libzfs_share.c
+20-32 files

OpenZFS/src 80fb85bmodule/zfs zfs_ioctl.c

Fix the integer type in zfs_ioc_userspace_many()

Fix the mismatched type in zfs_ioc_userspace_many() and limit the
number of entries returned to 1000.  When a size larger than this
is requested the response is truncated, zfs_userspace() already
correctly handles short responses.  Historically, zfs_userspace()
has requested 100 entries at a time, this cap allows for 10x larger
batch sizes if needed in the future.

Reported-by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li,
Reported-by: and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18615
DeltaFile
+8-2module/zfs/zfs_ioctl.c
+8-21 files

OpenZFS/src ef6f261cmd/zdb zdb.c

When reading a vdev label skip libzfs_core_init()

There's no need to call libzfs_core_init() when `zdb -l` is used to
read a vdev label.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: tiehexue <tiehexue at hotmail.com>
Closes #18606
DeltaFile
+1-1cmd/zdb/zdb.c
+1-11 files