OpenZFS/src 0483a8emodule/zfs vdev.c

Clean up embedded slog metaslab across txgs

On a read-write import, metaslab_set_fragmentation() can dirty a
metaslab via vdev_dirty() while still in the txg==0 load path when its
space map has an unexpected bonus size (e.g. a makefs-created pool
whose space-map dnodes use the boot loader's 24-byte space_map_phys_t
with nblkptr=3, giving db_size=64). If that metaslab is then selected
as the embedded slog, vdev_metaslab_init() only removed it from
vdev_ms_list when txg != 0, so the txg==0 case left it queued and
metaslab_fini() tripped VERIFY(!txg_list_member(&vd->vdev_ms_list,
msp, t)).

Remove slog_ms from the dirty list for every TXG_SIZE slot before
metaslab_fini() so the cleanup is correct regardless of txg.

Reported on FreeBSD as PR 281520:
External-issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281520

Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>

    [2 lines not shown]
DeltaFile
+4-3module/zfs/vdev.c
+4-31 files

OpenZFS/src 14c2857contrib/initramfs/hooks zfs.in

initramfs-zfs should not try to copy directories

We had find only return files from the beginning for libgcc.so, but not
libfetch/libcurl. This oversight affected a user when vmware installed
its own libcurl.so.4 in a directory called libcurl.so.4, since our code
then tried to copy a directory, which fails.

Reviewed-by: Chris Longros <chris.longros at gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Suggested-by: Carsten Härle <carsten.haerle at straightec.de>
Signed-off-by: Richard Yao <richard at ryao.dev>
Closes #18582
Closes #18686
DeltaFile
+1-1contrib/initramfs/hooks/zfs.in
+1-11 files

OpenZFS/src 562b96ctests/zfs-tests/tests/functional/cli_root/zfs_send_delegation zfs_send_test.ksh setup.ksh, tests/zfs-tests/tests/functional/cli_user/zfs_send_delegation_user zfs_send_usertest.ksh setup.ksh

ZTS: remove send_delegation tests

These tests are doing the same tests as delegate/zfs_allow_send, and are
hard to follow and maintain. There's no need for them now, so drop them.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18672
DeltaFile
+0-150tests/zfs-tests/tests/functional/cli_user/zfs_send_delegation_user/zfs_send_usertest.ksh
+0-111tests/zfs-tests/tests/functional/cli_root/zfs_send_delegation/zfs_send_test.ksh
+0-50tests/zfs-tests/tests/functional/cli_user/zfs_send_delegation_user/setup.ksh
+0-50tests/zfs-tests/tests/functional/cli_root/zfs_send_delegation/setup.ksh
+0-43tests/zfs-tests/tests/functional/cli_root/zfs_send_delegation/cleanup.ksh
+0-43tests/zfs-tests/tests/functional/cli_user/zfs_send_delegation_user/cleanup.ksh
+0-4472 files not shown
+0-4618 files

OpenZFS/src 4d1d00ftests/runfiles common.run, tests/zfs-tests/tests Makefile.am

ZTS: delegate: add test for send sub-permissions

Regular send and raw send are actually separate operations with separate
permissions. This adds a test to test the combinations properly using
the existing permission test infrastructure.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18672
DeltaFile
+43-0tests/zfs-tests/tests/functional/delegate/zfs_allow_send.ksh
+37-0tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib
+3-3tests/runfiles/common.run
+1-0tests/zfs-tests/tests/Makefile.am
+84-34 files

OpenZFS/src 714ad77.github/workflows unit-tests.yml

CI: Add a unit-tests workflow to our infrastructure

Run `make unit` on each PR so the unit-test suite (currently 64
tests) is tested as it grows.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <rob.norris at truenas.com>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18670
DeltaFile
+29-0.github/workflows/unit-tests.yml
+29-01 files

OpenZFS/src 5bdf5f7.github/workflows zfs-qemu.yml

CI: Re-allow workflow_dispatch on zfs-qemu

Allow zfs-qemu to be invoked from a workflow_dispatch event (a.k.a,
manually running a workflow).  This may have been accidentally disabled
in 1916c2c55.

Reviewed-by: Chris Longros <chris.longros at gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #18680
DeltaFile
+1-1.github/workflows/zfs-qemu.yml
+1-11 files

OpenZFS/src eb0c674module/os/freebsd/zfs zfs_vfsops.c, module/os/linux/zfs zfs_vfsops.c

zfs_ioctl: fix EBUSY race between quota queries and mount

zfsvfs_hold() fell back to zfsvfs_create() -> dmu_objset_own()
(exclusive) for unmounted datasets.  A concurrent zfs_domount()
also calls dmu_objset_own(), causing EBUSY on the same dataset.

Introduce zfsvfs_create_hold() using dmu_objset_hold() (shared
hold) instead.  Shared holds do not conflict with exclusive owns,
eliminating the race.  The release path (zfsvfs_rele,
zfsvfs_create_impl error) uses dmu_objset_ds()->ds_owner to
determine whether to disown or rele, avoiding the need for an
extra flag in zfsvfs_t.

Added tests userspace_005, groupspace_005, projectspace_006
(50 iter race test).

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: HeonJe Lee <lhjnano at gmail.com>
Closes #18611
DeltaFile
+100-0tests/zfs-tests/tests/functional/userquota/groupspace_005_pos.ksh
+100-0tests/zfs-tests/tests/functional/userquota/userspace_005_pos.ksh
+97-0tests/zfs-tests/tests/functional/projectquota/projectspace_006_pos.ksh
+30-1module/os/linux/zfs/zfs_vfsops.c
+30-1module/os/freebsd/zfs/zfs_vfsops.c
+22-2module/zfs/zfs_ioctl.c
+379-44 files not shown
+389-610 files

OpenZFS/src 87593eamodule/os/freebsd/zfs zfs_vnops_os.c

Fix handling of _PC_HAS_HIDDENSYSTEM for FreeBSD

The hidden and system flags are only supported for
ZFS pools if the z_use_fuids is true.  Fix
zfs_freebsd_pathconf() to check this.

Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Rick Macklem <rmacklem at uoguelph.ca>
Closes #18688
DeltaFile
+7-2module/os/freebsd/zfs/zfs_vnops_os.c
+7-21 files

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

spa: make ccw_retry_interval tunable on Linux (#18681)

zfs_ccw_retry_interval sets the time interval after which a retry of a
failed write of the configuration cache file is attempted. It was only
exposed on FreeBSD. Make it Linux tunable with ZFS_MODULE_PARAM and
document it in zfs.4.

Signed-off-by: Christos Longros <chris.longros at gmail.com>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Richard Yao <richard at ryao.dev>
DeltaFile
+0-9module/os/freebsd/zfs/sysctl_os.c
+4-0man/man4/zfs.4
+4-0module/zfs/spa.c
+8-93 files

OpenZFS/src a35e8d8. META

Linux 7.1 compat: META (#18682)

Update the META file to reflect compatibility with the 7.1
kernel.

Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Reviewed-by: Chris Longros <chris.longros at gmail.com>
DeltaFile
+1-1META
+1-11 files

OpenZFS/src 0a4b597.github/workflows zfs-qemu.yml README.md, .github/workflows/scripts qemu-2-start.sh

Update our CI runners to the newest FreeBSD 15.1 RELEASE (#18667)

Signed-off-by: Christos Longros <chris.longros at gmail.com>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
DeltaFile
+3-3.github/workflows/zfs-qemu.yml
+2-2.github/workflows/scripts/qemu-2-start.sh
+1-1.github/workflows/README.md
+6-63 files

OpenZFS/src a3073e5.github/workflows/scripts qemu-4-build-vm.sh

CI: Have zfs-build-packages workflow build tarballs on Alma (#18662)

Previously, zfs-build-packages would only build source tarballs
on Fedora due to problems with building them on RHEL 7.  That's
a relic of the past now, as we haven't supported RHEL 7 since
it went EOL in 2024.  With this change, we now build the tarballs
on both Alma and Fedora.

Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Olaf Faaland <faaland1 at llnl.gov>
Reviewed-by: Chris Longros <chris.longros at gmail.com>
DeltaFile
+3-4.github/workflows/scripts/qemu-4-build-vm.sh
+3-41 files

OpenZFS/src 7fe05a5module/zfs abd.c

abd: Fix stats asymmetry in case of Direct I/O

abd_alloc_from_pages() does not call abd_update_scatter_stats(),
since memory is not really allocated there.  But abd_free_scatter()
called by abd_free() does.  It causes negative overflow of some
ABD and possibly ARC counters.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <rob.norris at truenas.com>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18390
DeltaFile
+2-1module/zfs/abd.c
+2-11 files

OpenZFS/src ec88debmodule/zfs zil.c vdev_removal.c, tests/runfiles common.run

Fix log vdev removal issues

When we clear the log, we should clear all the fields, not only
zh_log.  Otherwise remaining ZIL_REPLAY_NEEDED will prevent the
vdev removal.  Handle it also from the other side, when zh_log
is already cleared, while zh_flags is not.

spa_vdev_remove_log() asserts that allocated space on removed log
device is zero.  While it should be so in perfect world, it might
be not if space leaked at any point.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18277
DeltaFile
+95-0tests/zfs-tests/tests/functional/removal/removal_with_missing_log.ksh
+16-4module/zfs/zil.c
+1-1tests/runfiles/common.run
+1-0tests/zfs-tests/tests/Makefile.am
+0-1module/zfs/vdev_removal.c
+113-65 files

OpenZFS/src e6a856fmodule/zfs dbuf.c

Simplify dnode_level_is_l2cacheable()

We should not dereference through dn_handle->dnh_dnode once we
already have a dnode pointer.  The result will be the same.

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

OpenZFS/src b4842ae. META

Tag zfs-2.3.8

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
DeltaFile
+1-1META
+1-11 files

OpenZFS/src e2705f6module/zfs zvol.c

ZVOL: Add encryption key check for block cloning

Somehow during block cloning porting from file systems was missed
the check for identical encryption keys.  As result, blocks cloned
between unrelated ZVOLs produced authentication errors on later
reads.  Having same or different encryption root does not matter.

This patch copies dmu_objset_crypto_key_equal() call from FS side.

Reviewed-by: Ameer Hamza <ahamza at ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18315
DeltaFile
+16-0module/zfs/zvol.c
+16-01 files

OpenZFS/src 7ab1633module/zfs dbuf.c

Remove parent ZIO from dbuf_prefetch()

I am not sure why it was added there 10 years ago, but it seems not
needed now.  According to my tests removing it improves sequential
read performance with recordsize=4K by 5-10% by reducing the CPU
overhead in prefetcher.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <robn at despairlabs.com>
Reviewed-by: Ameer Hamza <ahamza at ixsystems.com>
Reviewed-by: Akash B <akash-b at hpe.com>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18214
DeltaFile
+3-14module/zfs/dbuf.c
+3-141 files

OpenZFS/src 6d336famodule/zfs abd.c

abd: Fix stats asymmetry in case of Direct I/O

abd_alloc_from_pages() does not call abd_update_scatter_stats(),
since memory is not really allocated there.  But abd_free_scatter()
called by abd_free() does.  It causes negative overflow of some
ABD and possibly ARC counters.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <rob.norris at truenas.com>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18390
DeltaFile
+2-1module/zfs/abd.c
+2-11 files

OpenZFS/src b72c843module/zfs dbuf.c

Simplify dnode_level_is_l2cacheable()

We should not dereference through dn_handle->dnh_dnode once we
already have a dnode pointer.  The result will be the same.

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

OpenZFS/src 83020cf. META

Tag zfs-2.4.3

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
DeltaFile
+1-1META
+1-11 files

OpenZFS/src 1821ca2module/zfs zvol.c

ZVOL: Add encryption key check for block cloning

Somehow during block cloning porting from file systems was missed
the check for identical encryption keys.  As result, blocks cloned
between unrelated ZVOLs produced authentication errors on later
reads.  Having same or different encryption root does not matter.

This patch copies dmu_objset_crypto_key_equal() call from FS side.

Reviewed-by: Ameer Hamza <ahamza at ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18315
DeltaFile
+16-0module/zfs/zvol.c
+16-01 files

OpenZFS/src 50697dcmodule/zfs zil.c vdev_removal.c, tests/runfiles common.run

Fix log vdev removal issues

When we clear the log, we should clear all the fields, not only
zh_log.  Otherwise remaining ZIL_REPLAY_NEEDED will prevent the
vdev removal.  Handle it also from the other side, when zh_log
is already cleared, while zh_flags is not.

spa_vdev_remove_log() asserts that allocated space on removed log
device is zero.  While it should be so in perfect world, it might
be not if space leaked at any point.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18277
DeltaFile
+95-0tests/zfs-tests/tests/functional/removal/removal_with_missing_log.ksh
+16-4module/zfs/zil.c
+1-1tests/runfiles/common.run
+0-1module/zfs/vdev_removal.c
+1-0tests/zfs-tests/tests/Makefile.am
+113-65 files

OpenZFS/src 9711768module/zfs dbuf.c

Remove parent ZIO from dbuf_prefetch()

I am not sure why it was added there 10 years ago, but it seems not
needed now.  According to my tests removing it improves sequential
read performance with recordsize=4K by 5-10% by reducing the CPU
overhead in prefetcher.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <robn at despairlabs.com>
Reviewed-by: Ameer Hamza <ahamza at ixsystems.com>
Reviewed-by: Akash B <akash-b at hpe.com>
Signed-off-by: Alexander Motin <alexander.motin at TrueNAS.com>
Closes #18214
DeltaFile
+3-14module/zfs/dbuf.c
+3-141 files

OpenZFS/src 8489d70include/os/freebsd/spl/sys cmn_err.h kmem.h, include/sys spa.h vdev.h

Rename several printf attributes declarations to __printf__

For kernel builds on FreeBSD, we redefine `__printf__` to
`__freebsd_kprintf__`, to support FreeBSD kernel printf(9) extensions
with clang.

In OpenZFS various printf related functions are declared with
`__attribute__((format(printf, X, Y)))`, so these won't work with the
above redefinition. With clang 21 and higher, this leads to errors
similar to:

    sys/contrib/openzfs/module/zfs/spa_misc.c:414:38: error: passing
    'printf' format string where 'freebsd_kprintf' format string is
    expected [-Werror,-Wformat]
      414 |         (void) vsnprintf(buf, sizeof (buf), fmt, adx);
          |                                             ^

Since attribute names can always be spelled with leading and trailing
double underscores, rename these instances.

    [7 lines not shown]
DeltaFile
+8-8include/os/freebsd/spl/sys/cmn_err.h
+2-2include/os/freebsd/spl/sys/kmem.h
+2-2include/sys/spa.h
+1-1include/sys/vdev.h
+1-1include/sys/zfs_debug.h
+14-145 files

OpenZFS/src 07c1e2e. META

Tag zfs-2.2.10

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
DeltaFile
+1-1META
+1-11 files

OpenZFS/src 3d39a57include/os/freebsd/spl/sys cmn_err.h kmem.h, include/sys spa.h vdev.h

Rename several printf attributes declarations to __printf__

For kernel builds on FreeBSD, we redefine `__printf__` to
`__freebsd_kprintf__`, to support FreeBSD kernel printf(9) extensions
with clang.

In OpenZFS various printf related functions are declared with
`__attribute__((format(printf, X, Y)))`, so these won't work with the
above redefinition. With clang 21 and higher, this leads to errors
similar to:

    sys/contrib/openzfs/module/zfs/spa_misc.c:414:38: error: passing
    'printf' format string where 'freebsd_kprintf' format string is
    expected [-Werror,-Wformat]
      414 |         (void) vsnprintf(buf, sizeof (buf), fmt, adx);
          |                                             ^

Since attribute names can always be spelled with leading and trailing
double underscores, rename these instances.

    [7 lines not shown]
DeltaFile
+8-8include/os/freebsd/spl/sys/cmn_err.h
+2-2include/sys/spa.h
+2-2include/os/freebsd/spl/sys/kmem.h
+1-1include/sys/vdev.h
+1-1include/sys/zfs_debug.h
+14-145 files

OpenZFS/src 7e054b2tests/unit test_namecheck.c Makefile.am

unit/namecheck: test name validation

Add a test_namecheck unit suite covering zfs_namecheck name check
functions, including: pool, dataset, snapshot, bookmark, component,
permset and mountpoint, plus get_dataset_depth and dataset_nestcheck.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <rob.norris at truenas.com>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18643

* unit/namecheck: simplify name generation and helpers

1) introduce check_longname_invalid() and simplify the long-name helper
2) document that zfs_max_dataset_nesting is a tunable and drop the
   unnecessary restore
3) drop snprintf and use fixed intervals for the delimiters in a
   random string


    [4 lines not shown]
DeltaFile
+314-0tests/unit/test_namecheck.c
+15-1tests/unit/Makefile.am
+1-0tests/unit/.gitignore
+330-13 files

OpenZFS/src 77e64d8include/sys vdev.h, module/zfs vdev.c zfs_ioctl.c

Fix self-deadlock when setting the "allocating"/"path" vdev property

zfs_ioc_vdev_set_props() acquires the SCL_CONFIG lock as a reader and
holds it across the call to vdev_prop_set(). For the "allocating"
property, vdev_prop_set() calls spa_vdev_noalloc()/spa_vdev_alloc(),
which descend through spa_vdev_enter() into spa_config_enter(spa,
SCL_ALL, RW_WRITER); the "path" property does the same via
spa_vdev_setpath().

Acquiring SCL_CONFIG as a writer while the same thread already holds it
as a reader is a self-deadlock: the writer waits for scl_count to drain
to zero, but scl_count is the thread's own reader, which is not released
until vdev_prop_set() returns. As a result "zpool set allocating=off|on
<vdev>" hangs the calling thread, and txg_sync, which also needs
SCL_CONFIG as a reader, stalls behind it and freezes the pool.

The SCL_CONFIG reader was added by commit d65015938e19 ("Vdev allocation
bias/class change", #18493) to keep the vdev tree stable across the guid
lookup and the property handling.

    [28 lines not shown]
DeltaFile
+90-0tests/zfs-tests/tests/functional/cli_root/zpool_set/vdev_set_path.ksh
+67-15module/zfs/vdev.c
+80-0tests/zfs-tests/tests/functional/cli_root/zpool_set/vdev_set_allocating.ksh
+2-32module/zfs/zfs_ioctl.c
+2-2include/sys/vdev.h
+2-1tests/runfiles/common.run
+243-501 files not shown
+245-507 files

OpenZFS/src cc4f4a4module/zfs dsl_scan.c

dsl_scan: close errorscrub cursor on pause

If the cursor were ever to actively hold resources, not finalising it
would mean leaking those resources whenever the scrub is paused.

The cursor is already reinitialized from the stored serialized form
if/when it is resumed, so there's nothing we need from the old one, just
to release it.

Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #18603
DeltaFile
+1-0module/zfs/dsl_scan.c
+1-01 files