OpenZFS/src ec65e4b.github/workflows smatch.yml zloop.yml

CI: skip smatch, zloop, and zfs-arm for documentation-only changes

Follow-up to #18518, which skipped the qemu matrix on doc-only PRs.
zloop, zfs-arm, and smatch are irrelevant to doc-only changes.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18601
DeltaFile
+8-0.github/workflows/smatch.yml
+8-0.github/workflows/zloop.yml
+8-0.github/workflows/zfs-arm.yml
+24-03 files

OpenZFS/src d13663b.github/workflows/scripts qemu-6-lustre-tests-vm.sh

CI: Lustre 6.16 kernel compatibility fix (#18602)

Almalinux 9,10 kernels now include a backport of Linux commit
v6.15-13744-g41cb08555c41 which renames the from_timer() function
to timer_container_of().  Apply the upstream Lustre compatibility
patch to our builds.  This patch should be included in the next
Lustre release and can be dropped then.

ZFS-CI-Type: quick

Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
DeltaFile
+7-1.github/workflows/scripts/qemu-6-lustre-tests-vm.sh
+7-11 files

OpenZFS/src 472ddcacmd/zed/agents zfs_retire.c, module/zfs vdev.c spa.c

zed: Prefer spares with matching rotational and size

Before this change zed tried to activate spares just in order they
are stored in configuration, which is quite arbitrary.  To make
the result more optimal, sort the spares by their rotational status
and size, so that the most fitting ones have better chances.

To make it more visible, export the rotational status as a vdev
property.  While at it, minimally fix vdev properties reading for
spare and L2ARC vdevs, having no ZAPs.

To keep the rotational status for spare activation purposes when
failed device is already gone, save it into the vdev config.  The
same is for spare vdevs asize.

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 #18597
DeltaFile
+90-0tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_008_pos.ksh
+84-0tests/zfs-tests/tests/functional/fault/auto_spare_rotational.ksh
+78-4cmd/zed/agents/zfs_retire.c
+41-7module/zfs/vdev.c
+12-4module/zfs/spa.c
+8-0module/zfs/vdev_label.c
+313-158 files not shown
+328-1814 files

OpenZFS/src 3250b43.github/workflows checkstyle.yaml

CI: Update checkstyle checkout action to v6

The checkstyle workflow was the only one still pinned to
actions/checkout at v4; the other workflows already use v6.
Bump it to match.

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 #18600
DeltaFile
+1-1.github/workflows/checkstyle.yaml
+1-11 files

OpenZFS/src e30ab5fmodule Makefile.bsd

FreeBSD: Make it possible to build openzfs.ko with sanitizers

Add make options which let one respectively compile the kernel modules
with the address sanitizer, memory sanitizer, and undefined behaviour
sanitizer enabled.  This makes it much easier to run the ZTS with those
sanitizers enabled.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Chris Longros <chris.longros at gmail.com>
Signed-off-by: Mark Johnston <markj at FreeBSD.org>
Closes #18596
DeltaFile
+6-0module/Makefile.bsd
+6-01 files

OpenZFS/src dc58596config kernel-fs-parse.m4 kernel.m4, module/os/linux/zfs zpl_super.c

Linux 5.6 compat: fix fs_parse API mismatch

Added m4 macro to check fs_parse API signature and wrappers.  Before 
5.6, fs_parse() took a struct fs_parameter_description which wraps
the parameter specs with name and enum pointers. From 5.6, the 
description struct was removed and fs_parse() accepts the 
fs_parameter_spec directly.

Reviewed-by: Rob Norris <robn at despairlabs.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: tiehexue <tiehexue at hotmail.com>
Closes #18585
DeltaFile
+34-0config/kernel-fs-parse.m4
+23-2module/os/linux/zfs/zpl_super.c
+2-0config/kernel.m4
+59-23 files

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

spa: expose max_missing_tvds_cachefile and _scan on Linux

Register the two siblings of zfs_max_missing_tvds via
ZFS_MODULE_PARAM in spa.c

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18589
DeltaFile
+13-0man/man4/zfs.4
+0-12module/os/freebsd/zfs/sysctl_os.c
+6-0module/zfs/spa.c
+19-123 files

OpenZFS/src 8bfac28.github/workflows README.md

.github: update workflows README

Describe the current zfs-qemu pipeline, ci_type selection, supported
guests, and the code-checking and other auxiliary workflows.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18590
DeltaFile
+82-47.github/workflows/README.md
+82-471 files

OpenZFS/src 6c08f5dconfig ax_pthread.m4, lib/libspl Makefile.am

config: detect the right way to get pthreads

To get at userspace threads, we use a mix of -pthread and -lpthread to
compiler and/or linker. That's fine enough for the platforms we target
but its not exactly right (eg on Linux -pthread defines _REENTRANT, when
-lpthread does not), and won't work properly some other platforms that
we might end up on someday (eg illumos).

There's also a danger if we link together two compilations units, one
compiled with -pthread, one not, as calls between them may not properly
manage thread state.

Here we switch to use the AX_PTHREAD macro to detect the correct set of
flags for CFLAGS and LIBS, and add them to the default compilation
flags for all units.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18588
DeltaFile
+523-0config/ax_pthread.m4
+0-5tests/zfs-tests/cmd/Makefile.am
+1-3lib/libzfs_core/Makefile.am
+0-4lib/libspl/Makefile.am
+1-3lib/libzfs/Makefile.am
+1-3lib/libzpool/Makefile.am
+526-186 files not shown
+529-2412 files

OpenZFS/src 1294d44tests/unit test_zap.c

test_zap: cover all core ZAP operations

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18586
DeltaFile
+298-1tests/unit/test_zap.c
+298-11 files

OpenZFS/src 6ecaa19include/sys zap.h, module/zfs zap.c

zap: expose _by_dnode() variants of remaining core functions

Exposes the remaining internal implementation functions:
- zap_update_by_dnode()
- zap_length_by_dnode()
- zap_get_stats_by_dnode()

And creates zap_contains_by_dnode(), followng the same structure as the
other functions.

Together, these complete the "core" ZAP _by_dnode() API for the test
suite to use.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18586
DeltaFile
+17-5module/zfs/zap.c
+6-0include/sys/zap.h
+23-52 files

OpenZFS/src 605ae84tests/unit Makefile.am README.md

unit: TOPT make arg to pass test options through to the test binary

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18586
DeltaFile
+2-2tests/unit/Makefile.am
+4-0tests/unit/README.md
+6-22 files

OpenZFS/src 2e5b9bdtests/unit Makefile.am

unit: zero coverage counters before coverage run

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18586
DeltaFile
+3-1tests/unit/Makefile.am
+3-11 files

OpenZFS/src efdc755tests/zfs-tests/tests/functional/cli_root/zinject zinject_args.ksh

ZTS/zinject: cover label, object, delay, panic and verify effect (#18579)

* ZTS/zinject: cover label, object, delay, panic and verify effect

Cover the device, label, object, delay and panic injection modes:
every valid value is accepted and unknown values are rejected. A
final pass confirms that registered injections execute by watching
the inject counter advance after triggering the desired injected
error.

Signed-off-by: Christos Longros <chris.longros at gmail.com>

* ZTS/zinject: add author copyright

Signed-off-by: Christos Longros <chris.longros at gmail.com>

---------

Signed-off-by: Christos Longros <chris.longros at gmail.com>
DeltaFile
+138-2tests/zfs-tests/tests/functional/cli_root/zinject/zinject_args.ksh
+138-21 files

OpenZFS/src 88656cctests/zfs-tests/tests/functional/alloc_class alloc_class_012_pos.ksh alloc_class.kshlib

ZTS/alloc_class: move file_in_special_vdev to alloc_class.kshlib

Move the function into the shared library.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18584
DeltaFile
+0-35tests/zfs-tests/tests/functional/alloc_class/alloc_class_012_pos.ksh
+34-0tests/zfs-tests/tests/functional/alloc_class/alloc_class.kshlib
+34-352 files

OpenZFS/src af0228btests/zfs-tests/tests/functional/cli_root/zpool_expand zpool_expand_005_pos.ksh

ZTS: zpool_expand_005_pos: correct variable name in expandsize check

The check referenced $zpool_expandsize, which is not defined in this
test; the variable assigned two lines above is $expandsize. A "-"
value returned by zpool reopen therefore did not trigger the
intended log_fail, and the failure surfaced only at the later
post-online-e size check with a less specific message.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18580
DeltaFile
+1-1tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_005_pos.ksh
+1-11 files

OpenZFS/src 112b013module/os/linux/zfs zpl_xattr.c

zpl_xattr: stop heap-allocating prefixed xattr names

The six __zpl_xattr_{user,trusted,security}_{get,set} entry points
built their prefixed name via kmem_asprintf("%s%s", prefix, name)
and freed it with kmem_strfree on the way out.

The Linux xattr API caps the full prefix+name length at
XATTR_NAME_MAX (255), the same bound fs/xattr.c's syscall handlers
rely on with their stack-resident struct xattr_name, and so do
the same in our xattr handlers.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <rob.norris at truenas.com>
Reviewed-by: Ameer Hamza <ahamza at ixsystems.com>
Signed-off-by: Andrew Walker <andrew.walker at truenas.com>
Closes #18570
DeltaFile
+56-36module/os/linux/zfs/zpl_xattr.c
+56-361 files

OpenZFS/src 8f6f4bctests/runfiles sanity.run

ZTS: update sanity.run file

Several of the tests included in the sanity.run file are no
longer quick.  In fact, the pyzfs tests can take over 5 minutes
to run which exceeds the allowed default timeout resulting the
the testing being killed.

Perform a little housekeeping and drop any test which takes more
than 10 seconds to run.  This brings things back a little closer
to the original intent of having a battery of useful test cases
which can be run in ~10 minutes.

ZFS-CI-Type: quick
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18576
DeltaFile
+6-27tests/runfiles/sanity.run
+6-271 files

OpenZFS/src 1d601ebtests/unit test_zap.c Makefile.am

unit/test_zap: a trivial ZAP unit test suite

This commit adds the bones of a unit test suite for the ZAP subsystem.
The actual tests themselves don't do much, just ZAP creation and
destruction and basic KV ops. At this point its intended to be enough to
demonstrate what tests under this framework would look like.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18564
DeltaFile
+273-0tests/unit/test_zap.c
+23-1tests/unit/Makefile.am
+2-0tests/unit/.gitignore
+298-13 files

OpenZFS/src a20ef9ctests/unit mock_dmu.c mock_dmu.h

unit: dnode/dbuf/dmu_tx mocks

Some simple initial mock for key DMU structures. It's hard to say this
early how generalisable these are, however they are enough for the ZAP
unit tests (next commit).

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18564
DeltaFile
+393-0tests/unit/mock_dmu.c
+47-0tests/unit/mock_dmu.h
+2-0tests/unit/Makefile.am
+442-03 files

OpenZFS/src 82b33c0tests/unit munit.c munit.h

unit: a unit testing framework

This commit establishes a unit test framework for OpenZFS, and
integrates it into the build.

It includes:
- the "munit" unit test framework (munit.c, munit.h)
- some light extensions to munit and glue for OpenZFS (unit.c, unit.h)
- make targets for running tests and generating coverage reports
- a document explaining the what, how and why

This is a first step; I expect we will extend all of this as we use it
more places and gain experience with it.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18564
DeltaFile
+2,458-0tests/unit/munit.c
+575-0tests/unit/munit.h
+189-0tests/unit/README.md
+85-0tests/unit/unit.c
+60-0tests/unit/unit.h
+60-0tests/unit/Makefile.am
+3,427-03 files not shown
+3,431-09 files

OpenZFS/src accb2b4.github/workflows/scripts generate-ci-type.py

CI: run full CI when a workflow YAML changes

FULL_RUN_REGEX in generate-ci-type.py covered .github/workflows/scripts/
but not the workflow YAML files, so a PR that only edited zfs-qemu.yml
got "quick" CI and never tested its own matrix change. Add the YAML
files to the list.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18577
DeltaFile
+1-0.github/workflows/scripts/generate-ci-type.py
+1-01 files

OpenZFS/src 1916c2c.github/workflows zfs-qemu.yml zfs-arm.yml

CI: skip full CI runs on push events

Full CI runs for proposed changes always occur in the PR where the
review is done and patch approved.  Once merged the full CI is run
again using the merged commit.  This is somewhat overkill.  In the
interest of reducing the CI load only run the zloop and checkstyle
workflows which are enough to verify the build on the master branch.
Push events to forks will continue to trigger a full CI run.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18571
DeltaFile
+9-2.github/workflows/zfs-qemu.yml
+1-0.github/workflows/zfs-arm.yml
+1-0.github/workflows/codeql.yml
+1-0.github/workflows/smatch.yml
+12-24 files

OpenZFS/src 9717917.github/workflows zfs-qemu.yml, .github/workflows/scripts qemu-2-start.sh

CI: enable FreeBSD 15.0-RELEASE in matrix

Add freebsd15-0r to the FreeBSD presets

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18561
DeltaFile
+2-2.github/workflows/zfs-qemu.yml
+1-1.github/workflows/scripts/qemu-2-start.sh
+3-32 files

OpenZFS/src 1576195.github/workflows zfs-qemu-packages.yml, .github/workflows/scripts qemu-4-build-vm.sh

CI: Build custom branch from zfs-qemu-packages

The zfs-qemu-packages workflow allows us to easily build RPMs for the
current branch.  However, there can be cases where we want to use the
current CI environment to build older releases.  This can happen when
the VM or runner environment changes, and the older CI doesn't have
the updates needed to run with it anymore.

This commit adds in a text box to specify a specific branch/tag to build
using the current CI environment.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #18569
DeltaFile
+30-2.github/workflows/scripts/qemu-4-build-vm.sh
+12-0.github/workflows/zfs-qemu-packages.yml
+42-22 files

OpenZFS/src 58d7194module/os/linux/zfs zpl_super.c

linux/super: properly apply ro/rw mount option to superblock

f5a9e3a622 changed how SB_RDONLY was applied to the new mount in a way
that was too simplistic - it only sets readonly on the filesystem if the
mount was 'ro', but it never clears it if the mount was 'rw'. This
causes the 'rw' option to effectively be ignored, and so the readonly=
property wins out.

This fixes it by doing it the right way: checking the flags mask to see
if it was actually provided as an option at all, and then setting or
clearing it as appropriate.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18557
Closes #18563
DeltaFile
+8-3module/os/linux/zfs/zpl_super.c
+8-31 files

OpenZFS/src 20437d8tests/runfiles common.run sanity.run, tests/zfs-tests/tests Makefile.am

ZTS/zfs_mount: test that ro/rw mount methods remain consistent

Whether a mount ends up as read-only or read-write depends on a
combination of platform, readonly= filesystem property, mount method
(system mount(8) or zfs-mount(8)) and mount option provided (ro, rw or
none).

This tests all combinations, and ensures they match what has
traditionally been expected on this platform, so we'll know if we
accidentally changed it.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18557
Closes #18563
DeltaFile
+130-0tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_ro_rw.ksh
+2-2tests/runfiles/common.run
+1-1tests/runfiles/sanity.run
+1-0tests/zfs-tests/tests/Makefile.am
+134-34 files

OpenZFS/src b394b87tests/zfs-tests/tests/functional/cli_root/zfs_mount zfs_mount.kshlib zfs_mount_remount.ksh

ZTS/zfs_mount: lift & update helpers from zfs_mount_remount

zfs_mount_remount has some nice helpers for checking the claimed and
actual read-only/read-write state of a mount. I wanted to use them for
another test but they weren't exactly what I wanted.

This adds separate functions for the different kinds of mounts the
zfs_mount_remount test wants to use, mostly to avoid the assymetry of
sometimes calling a helper function and sometimes doing it direct. It
also separates the code to get the current ro/rw mount option from
actually asserting it.

Test has been updated to use the new functions, but the logic and
structure has not changed.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18557
Closes #18563
DeltaFile
+128-0tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib
+28-75tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_remount.ksh
+156-752 files

OpenZFS/src f9bf31f.github/workflows/scripts qemu-3-deps-vm.sh

ZTS: zfs_unshare_006_pos.ksh enable usershares

Ensure samba usershares are enabled in the CI test environment for
the zfs_unshare_006_pos test case.  By default they are disabled
in the Ubuntu 26.04 LTS and must be enabled.

Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18547
DeltaFile
+3-0.github/workflows/scripts/qemu-3-deps-vm.sh
+3-01 files

OpenZFS/src d64dcd2tests/zfs-tests/tests/functional/stat statx_dioalign.ksh

ZTS: statx_dioalign.ksh update to stride_dd

The uutils 0.8.0 version of dd appears to diverge from GNU behavior
and does not fail when an unaligned write O_DIRECT write is issued.
Update the test case to use stride_dd which is provided by the ZTS
so the expected syscall behavior can be verified.

Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18547
DeltaFile
+6-5tests/zfs-tests/tests/functional/stat/statx_dioalign.ksh
+6-51 files