OpenZFS/src 0317365 — tests/zfs-tests/tests/functional/mmp mmp.kshlib mmp_on_off.ksh

ZTS: mmp_on_off must not leave a suspended pool behind

mmp_on_off runs with zfs_multihost_interval=100 and the default ten
fail intervals, so MMP suspends the pool when no MMP write has
succeeded for one second.  In CI one MMP write took 1.25 s:

    WARNING: MMP writes to pool 'testpool' have not succeeded in
    over 1109 ms; suspending pool

A pool suspended by MMP can't be cleared on its own host (#19033), so
cleanup failed ("pool is imported on a different host") and left it
imported.  The tests after it failed on their zpool create, and
mmp_on_zdb's cleanup destroyed it: zpool destroy -f unmounts the root
dataset, and the unmount waits in zil_commit() for the suspended pool
forever, so the CI job ran into its 300 minute timeout.

mmp_clear_suspended() should have stopped that destroy, but it asks
zpool for the pool's health, and once a cleanup has removed the
hostid, zpool reports the hostid mismatch (ONLINE), not the

    [12 lines not shown]
DeltaFile
+11-0tests/zfs-tests/tests/functional/mmp/mmp_on_off.ksh
+5-1tests/zfs-tests/tests/functional/mmp/mmp.kshlib
+16-12 files

OpenZFS/src f43a4c0 — .github/workflows/scripts qemu-test-repo-vm.sh

CI: handle failed module load in zfs-qemu-packages

There are cases where the dkms packages will build but fail to load
while doing the test install step of zfs-qemu-packages.  When
that happens, we should mark the specific test as a failure but
continue with the other test installs.  Also print some diagnostic
info on why the module load failed.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matthew Ahrens <matt at mahrens.org>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #20100
DeltaFile
+12-1.github/workflows/scripts/qemu-test-repo-vm.sh
+12-11 files

OpenZFS/src 8f3b221 — .github/workflows/scripts qemu-2-start.sh

CI: update Alpine Linux 3.24 image to 3.24.4 (#20033)

Bump the Alpine 3.24 QEMU cloudinit image from 3.24.2-r2 to 3.24.4-r0.

Assisted-by: Antigravity

Signed-off-by: Ananda Bhattacharya <a3217055 at gmail.com>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Alexander Moch <mail at alexmoch.com>
DeltaFile
+2-2.github/workflows/scripts/qemu-2-start.sh
+2-21 files

OpenZFS/src db7c3d6 — tests/zfs-tests/tests/functional/fault auto_offline_001_pos.ksh

ZTS: auto_offline_001_pos: rescan only the scsi_debug host

insert_disk without a host makes scan_scsi_hosts write "- - -" to the
scan file of every SCSI host. On a VM with eight virtio_scsi
controllers, each of those scans takes about 9 seconds: for every LUN
it probes and does not find, the scan allocates a temporary device and
frees it again, and each time the host's shared tag set is updated,
which freezes the queue of the disk behind it. A reattach then takes
about 67 seconds, and the test, which reattaches its disk eight
times, is killed at its 10 minute timeout.

Every other caller of insert_disk passes the host of its device. Do the
same here: record the scsi_debug host before the first removal, while
the device still exists, and rescan only that host.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Closes #20060
DeltaFile
+6-3tests/zfs-tests/tests/functional/fault/auto_offline_001_pos.ksh
+6-31 files

OpenZFS/src 4bc572f — module/zfs vdev_anyraid.c

anyraid: allow a child capacity of 65536 tiles

The header of each copy of the AnyRAID tile map records the capacity
of every child, in tiles, as a 16-bit value: the writer stores the
capacity minus one and anyraid_open_existing() adds one back, so
capacities from 1 to VDEV_ANYRAID_MAX_TPD (2^16) round-trip.
vdev_anyraid_open() and vdev_anyraid_expand() cap a child at that
many tiles, so one with room for more gets exactly 2^16.  The
assertion in vdev_anyraid_write_map_sync() bounds the capacity by
UINT16_MAX instead, one less.

A debug build thus fails the assertion on the first sync of a pool
with such a child, which is a little over 4 TiB with 64 MiB tiles: at
"zpool create", and when it imports a pool created without
assertions, with the child present or missing.  Builds without
assertions record and read the capacity correctly.

Bound the capacity by VDEV_ANYRAID_MAX_TPD.  The lower bound stays: a
capacity of 0 would be read back as 2^16, and only a child that holds

    [6 lines not shown]
DeltaFile
+2-1module/zfs/vdev_anyraid.c
+2-11 files

OpenZFS/src 53b757b — tests/runfiles common.run, tests/zfs-tests/tests Makefile.am

ZTS: create AnyRAID with a child of 2^16 tiles

An AnyRAID child holds at most VDEV_ANYRAID_MAX_TPD (2^16) tiles, and
the header of the tile map records its capacity minus one in 16 bits,
but the writer of the map asserts that the capacity itself fits in 16
bits.  A debug build fails that assertion on the first sync of a pool
with a child that holds 2^16 tiles.

Add a test that creates an anymirror1 pool with 16 MiB tiles on two
sparse files of 512 MiB and one of 1025 GiB, which gets 2^16 tiles,
imports it read-only without the large file, so that its capacity is
read from the map, then with it, and scrubs it.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Signed-off-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Closes #19849
DeltaFile
+88-0tests/zfs-tests/tests/functional/anyraid/anyraid_tile_capacity_max.ksh
+1-1tests/runfiles/common.run
+1-0tests/zfs-tests/tests/Makefile.am
+90-13 files

OpenZFS/src 624ec76 — module/zfs vdev_anyraid.c

anyraid: fail the creation when a child fails to open

When a vdev is created, vdev_anyraid_open() works out the tile size
from the sizes of its children and has no capacity recorded for them,
so child_capacities stays NULL.  The children that failed to open are
counted against the parity, and when there are no more than nparity of
them, the tiles of each one are read from child_capacities, with only
an assertion that it is set.  A child that failed before its size was
known does not get there, as anyraid_calculate_size() reports it as
too small, but one that fails after vdev_open() has set its asize, as
when the probe of the device fails on I/O errors, makes a build without
assertions read through a NULL pointer, which panics the kernel.

vdev_create() fails a vdev with a child that did not open anyway, so
return the child's error once anyraid_calculate_size() has run, which
keeps its report of the children that are too small.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>

    [2 lines not shown]
DeltaFile
+12-2module/zfs/vdev_anyraid.c
+12-21 files

OpenZFS/src 93a3cf5 — tests/runfiles linux.run, tests/zfs-tests/tests Makefile.am

ZTS: create AnyRAID with a child that fails to open

When a vdev is created, vdev_anyraid_open() has no capacity recorded
for its children, and reads one from a NULL array for each child that
failed to open.  A child that failed before its size was known never
gets there: anyraid_calculate_size() reports it as too small.  One that
fails after, as when the probe of the device fails on I/O errors, trips
an assertion on debug builds and makes other builds dereference NULL,
which panics the kernel.

The test puts one of three sparse files on a full tmpfs, where the
probe of the device cannot write the blocks of its labels it rewrites,
and checks that creating an anymirror1 pool on them fails, reporting
that a device could not be opened, and leaves no pool.  It then moves
that file out of the tmpfs and checks that the pool is created.  It
mounts a tmpfs, so it runs on Linux only.  The next commit fixes the
bug.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>

    [3 lines not shown]
DeltaFile
+71-0tests/zfs-tests/tests/functional/anyraid/anyraid_create_child_fails.ksh
+4-0tests/runfiles/linux.run
+1-0tests/zfs-tests/tests/Makefile.am
+76-03 files

OpenZFS/src 9203846 — module/zfs vdev_anyraid.c

anyraid: report the full names of disks too small for a tile

anyraid_calculate_size() copies the name of each disk too small for a
tile into a 64-byte buffer, so zpool create reports paths longer than
63 characters cut short, as /dev/disk/by-id paths often are.  The ZTS
test of the rounded tile size, which matches the names it expects,
then fails when the test directory's path is long.  Use MAXPATHLEN
buffers instead.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Signed-off-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Closes #19836
DeltaFile
+4-3module/zfs/vdev_anyraid.c
+4-31 files

OpenZFS/src d0a06ed — man/man4 zfs.4, module/zfs vdev_anyraid.c

anyraid: check the disks against the rounded tile size

anyraid_calculate_size() checks that the smallest disk holds
vdev_anyraid_min_tile_size and 2^vdev_anyraid_disk_shift bytes, takes
the larger of the minimum and the smallest disk shifted right, and
rounds it up to a power of two.  The rounding can take the tile past
the smallest disk: with a 100 MiB minimum, a disk with 105.5 MiB of
room for tiles passes the check and gets 128 MiB tiles, and so does,
with a shift of 0, any disk whose room is not a power of two.  Such a
disk holds no tile, and calculate_asize() assumes that only a child
that failed to open has none.  It trips an assertion on debug builds.
Without assertions, it dereferences a NULL pointer when fewer than
nparity + 1 children hold a tile, and otherwise creates the vdev with
a child that never holds one, which trips the same assertion when a
debug build imports the pool.

Check the disks against the rounded tile size instead, list those
below it, and report that size, plus the AnyRAID maps, as the minimum
device size.  The tile size of a vdev whose disks all hold a tile is

    [13 lines not shown]
DeltaFile
+25-14module/zfs/vdev_anyraid.c
+2-0man/man4/zfs.4
+27-142 files

OpenZFS/src 8ee4d5f — tests/runfiles common.run, tests/zfs-tests/include tunables.cfg

ZTS: AnyRAID disks must hold a tile of the rounded size

The tile size of a new AnyRAID vdev is rounded up to a power of two,
but the disks are only checked against the size before rounding.  With
a vdev_anyraid_min_tile_size that is not a power of two, or with a
vdev_anyraid_disk_shift of 0, the tile can be larger than the smallest
disk, which then holds no tile.  On "zpool create", calculate_asize()
then trips an assertion on debug builds, which panics the kernel.
Without assertions, it dereferences a NULL pointer when fewer than
nparity + 1 disks hold a tile, and otherwise creates the vdev with a
disk that never holds one.

The test makes three files with 105.5 MiB of room for tiles each, and
checks that creating an anymirror1 pool on them fails, lists the three
files and reports the AnyRAID maps plus a 128 MiB tile as the minimum
device size, once with a 100 MiB minimum tile size and once with a
disk shift of 0.  It then grows two of the files and checks that the
creation fails and lists only the third, and grows the third and
checks that the pool is created with 128 MiB tiles.  The next commit

    [6 lines not shown]
DeltaFile
+105-0tests/zfs-tests/tests/functional/anyraid/anyraid_tile_size_rounding.ksh
+2-1tests/runfiles/common.run
+1-0tests/zfs-tests/tests/Makefile.am
+1-0tests/zfs-tests/include/tunables.cfg
+109-14 files

OpenZFS/src c615b79 — .github/workflows/scripts qemu-1-setup.sh

CI: calculate and prioritize fast apt mirrors in QEMU setup

GitHub-hosted ubuntu-24.04 runners land on both Azure and AWS EC2, where
default cloud apt mirrors frequently throttle or stall until the 60
minute Setup QEMU timeout.  Probe a random sample of US mirrors in
parallel, rank them fastest-first in /etc/apt/apt-mirrors.txt with short
socket timeouts and the official Ubuntu mirrors as fallbacks, and retry
on the next mirror if apt-get install exceeds 5 minutes.

Also run apt-get update only after the mirrors are ranked, and fix the
quoting of the unneeded package pattern so the preinstalled packages
are actually removed.

Assisted-by: Antigravity
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Ananda Bhattacharya <a3217055 at gmail.com>
Closes #20027
DeltaFile
+66-21.github/workflows/scripts/qemu-1-setup.sh
+66-211 files

OpenZFS/src 8919e31 — tests/zfs-tests/tests/functional/anyraid anyraid_clean_mirror_003_pos.ksh anyraid_clean_mirror_002_pos.ksh, tests/zfs-tests/tests/functional/cli_root/zdb zdb_display_block.ksh

ZTS: clean up everything a test creates

These tests' cleanup leaves some of what the test made or changed, or
stops partway:

- zpool_attach_003_pos: don't stop the cleanup when the pool does not
  exist, so that the vdev files are still removed.
- anyraid_tile_layout: remove the file vdevs.
- zed_slow_io, zed_slow_io_many_vdevs, zed_diagnose_multiple: remove
  the mount point directory.
- removal_cancel: destroy the pool.
- slog_015_neg: remove the vdev directories.
- zvol_misc_fua: remove the temporary files even when the cleanup
  fails partway, and remove each of them once.  Restore
  zvol_use_blk_mq, which the test left set to 1.
- import_log_missing: remove the backup device directory, in the
  zpool_import cleanup that all these tests use.
- mmp tests: remove the vdev directory, not only its files.
- anyraid tests, zpool_add_001_pos, zpool_add_009_neg,

    [21 lines not shown]
DeltaFile
+0-15tests/zfs-tests/tests/functional/zvol/zvol_swap/cleanup.ksh
+0-12tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg
+6-6tests/zfs-tests/tests/functional/cli_root/zdb/zdb_display_block.ksh
+8-0tests/zfs-tests/tests/functional/anyraid/anyraid_clean_mirror_003_pos.ksh
+8-0tests/zfs-tests/tests/functional/anyraid/anyraid_clean_mirror_002_pos.ksh
+8-0tests/zfs-tests/tests/functional/anyraid/anyraid_clean_mirror_001_pos.ksh
+30-3341 files not shown
+103-5847 files

OpenZFS/src f0df708 — tests/zfs-tests/tests/functional/cli_root/zfs_create zfs_create_010_neg.ksh, tests/zfs-tests/tests/functional/libzfs libzfs_input.ksh

ZTS: destroy the datasets that tests create

These tests pass but leave datasets, snapshots or bookmarks in their
group's pools, where later tests in the group can trip over them:

- zfs_rename_001_pos, 002_pos, 004_neg, 005_neg: destroy the file
  system and container that additional_setup creates.
- zfs_rename_012_neg, libzfs_input, pam_mount_recursively,
  pam_recursive, send_encrypted_freeobjects, send_freeobjects: add a
  cleanup function, which they did not have.
  pam_mount_recursively's and pam_recursive's also delete the user
  that the test adds.
- zfs_bookmark_cliargs: put back an empty recv dataset in place of the
  received one; zfs_bookmark_recursive: destroy its bookmarks.
- zfs_create_010_neg: destroy the volume if the test created it.
- zfs_destroy_clone_livelist, zfs_mount_remount,
  zfs_share_concurrent_shares, zfs_unload-key_recursive,
  idmap_mount_005, user_namespace_002, xattr_004_pos,
  send_partial_dataset: destroy the datasets that the cleanup missed.

    [16 lines not shown]
DeltaFile
+10-1tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh
+7-2tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_010_neg.ksh
+8-1tests/zfs-tests/tests/functional/rsend/send-c_longname.ksh
+9-0tests/zfs-tests/tests/functional/pam/pam_recursive.ksh
+9-0tests/zfs-tests/tests/functional/pam/pam_mount_recursively.ksh
+9-0tests/zfs-tests/tests/functional/libzfs/libzfs_input.ksh
+52-418 files not shown
+124-724 files

OpenZFS/src 8510fc2 — tests/zfs-tests/tests/functional/cli_root/zdb zdb_004_pos.ksh zdb_006_pos.ksh, tests/zfs-tests/tests/functional/cli_root/zpool_expand zpool_expand_003_neg.ksh zpool_expand_001_pos.ksh

ZTS: detach devices and clear labels that tests leave

- mmp_on_zdb, zdb_004_pos, zdb_006_pos: clear the labels of the pool's
  own vdevs.  The cleanup ran labelclear on $DEV_RDSKDIR/$DISK, which
  misses the labels in a whole disk's partition, so a pool these tests
  left exported stayed on the disks.  zdb_004_pos does that every time
  it runs.
- zpool_expand_001_pos, zpool_expand_003_neg: detach the loop device
  without first looking for its name in "losetup -a".  Where /dev/loop
  is a directory (Alpine), "losetup -a" names it /dev/loop/N, while
  "losetup -f", which chose it, names it /dev/loopN, so a loop device
  was left attached in each pass.
- zvol_misc_zil: wait for the zvol's device node before writing to it,
  so that the test does not create a regular file at its path in
  /dev/zvol.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Closes #20082
DeltaFile
+5-5tests/zfs-tests/tests/functional/mmp/mmp_on_zdb.ksh
+4-2tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh
+3-2tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
+2-1tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh
+2-1tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh
+1-0tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_zil.ksh
+17-116 files

OpenZFS/src dbbfc79 — tests/zfs-tests/tests/functional/channel_program/lua_core tst.memory_limit.ksh, tests/zfs-tests/tests/functional/cli_root/zfs_destroy zfs_clone_livelist_condense_races.ksh

ZTS: restore the tunables that tests change

These tests change a tunable and then never set it back, or set it to a
value that is not its default, so the tests after them run with a
different value:

- zfs_send_006_pos: zfs_override_estimate_recordsize was left at 8192
  (default 0).
- zpool_scrub_print_repairing: zfs_scan_vdev_limit was set to 4 MB
  (default 16 MB).
- import_rewind_config_changed, import_rewind_device_replaced: the
  zpool_import cleanup set zfs_txg_history to 0 (default 100).
- tst.memory_limit: zfs_lua_max_memlimit was never restored.
- async_destroy_001_pos: zfs_async_block_max_blocks was set to 100000
  (default unlimited).
- zfs_clone_livelist_condense_races: zfs_livelist_condense_zthr_cancel
  and _sync_cancel were never reset, and a failed destroy skipped
  resetting the other tunables.  Destroying a clone that is still
  condensing increments the counters, so they are reset again after the

    [11 lines not shown]
DeltaFile
+8-1tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_clone_livelist_condense_races.ksh
+8-0tests/zfs-tests/tests/functional/channel_program/lua_core/tst.memory_limit.ksh
+4-1tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_device_replaced.ksh
+4-1tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh
+2-1tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_print_repairing.ksh
+2-1tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh
+28-54 files not shown
+33-810 files

OpenZFS/src fe55f89 — tests/zfs-tests/include libtest.shlib, tests/zfs-tests/tests/functional/fadvise fadvise_willneed_limit.ksh

ZTS: restore the ARC size limits that tests lower

The l2arc_dwpd_*, l2arc_multidev_* and fadvise_willneed_limit tests
lower zfs_arc_max and zfs_arc_min, and their cleanup writes back the
saved value, usually 0.  Writing 0 does not change the ARC's limits, so
the rest of the run had a 400 MB ARC.  New libtest helpers
save_arc_limits and restore_arc_limits save the ARC's actual limits and
restore them before the tunables.

The l2arc tests also set zfs_arc_max before they lower zfs_arc_min.  On
a host whose ARC minimum is above 400 MB, such as a FreeBSD machine
with 32 GB of memory, FreeBSD rejects that maximum and the tests fail;
Linux ignores it, with a warning, until the minimum comes down.  A
third helper, set_arc_limits, sets the maximum first, after lowering the
minimum out of its way if needed.  The tests and restore_arc_limits use
it, and restore_arc_limits writes back only the tunables that changed,
so it can also restore a minimum equal to the maximum.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>

    [3 lines not shown]
DeltaFile
+57-0tests/zfs-tests/include/libtest.shlib
+3-6tests/zfs-tests/tests/functional/l2arc/l2arc_multidev_throughput_pos.ksh
+3-6tests/zfs-tests/tests/functional/l2arc/l2arc_multidev_scaling_pos.ksh
+3-6tests/zfs-tests/tests/functional/l2arc/l2arc_dwpd_reimport_pos.ksh
+3-6tests/zfs-tests/tests/functional/l2arc/l2arc_dwpd_ratelimit_pos.ksh
+3-6tests/zfs-tests/tests/functional/fadvise/fadvise_willneed_limit.ksh
+72-306 files

OpenZFS/src 0e41724 — include/sys dmu_objset.h, module/zfs dmu_objset.c

Check objset MACs directly

When an objset block is smaller than the pool's objset_phys_t size,
dmu_objset_open_impl() copies it into a larger anonymous ARC buffer.
The copy isn't marked unauthenticated, so dmu_objset_own() and
non-raw sends accept it without checking its MACs, and the next write
computes new MACs over it. Encrypted objsets written by older illumos
ZFS are 2 KiB, so they take this path on pools with project quotas
enabled.

Have dmu_objset_authenticate() check the MACs of os_phys itself
rather than rely on the ARC's mark. The zero padding of a copy doesn't
change the MACs. A new objset has no MACs to check, so it starts out
authenticated.

Reviewed by: George Wilson <gwilson at zfsmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Closes #19884
DeltaFile
+33-8module/zfs/dmu_objset.c
+3-3include/sys/dmu_objset.h
+36-112 files

OpenZFS/src 0f13e95 — include/sys dmu_objset.h, module/zfs dsl_crypt.c dmu_send.c

Check objset MACs in one place

dmu_objset_own() and non-raw sends each check the MACs of an
encrypted objset by looking at the ARC header of os_phys_buf, without
a lock, while the sync thread may be writing the objset and replacing
that header.

Move the check into dmu_objset_authenticate(). Mark the objset as
being written from before os_phys_buf is released until the write is
done, and have the check wait for a write in progress. Record in the
objset that its MACs have been checked, so that later callers skip
the check and don't wait. A raw receive changes the MACs, so it marks
them unchecked again.

Reviewed by: George Wilson <gwilson at zfsmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Closes #19884
DeltaFile
+73-12module/zfs/dmu_objset.c
+3-13module/zfs/dmu_send.c
+14-0include/sys/dmu_objset.h
+7-2module/zfs/dsl_crypt.c
+97-274 files

OpenZFS/src 02e5619 — scripts zfs-tests.sh, tests/runfiles common.run

ZTS: make zfs-tests.sh -t NAME select the test of that name

zfs-tests.sh -t NAME, given a name rather than a path, runs the first
path under the test suite whose name starts with NAME, in directory
order.  Many tests share that prefix with something that is not the
test: a helper program (bin/mmap_ftruncate once installed, or
cmd/mmap_ftruncate.c in a source tree; likewise mmap_read_truncate,
mmap_eof_extend, mount_null_source, send_doall, file_append), a
directory named after the test (zfs_rewrite, zfs_load-key), a data
file (a channel program's .zcp or .out), an object file, or another
test (tst.clone_neg for tst.clone).  Which path comes first depends on
the file system.  A directory or a data file makes test-runner reject
the runfile, so nothing runs; an installed helper is an executable
file, so test-runner runs it instead of the test.

Search only tests/, and for a file named NAME.ksh or NAME first, so
that the tests that are programs (hkdf_test, many_fds, page_alignment,
tmpfile_*) are still found, and skip .libs, where libtool keeps a
second copy of such a program in a build tree.  Only when no file has

    [10 lines not shown]
DeltaFile
+89-0tests/zfs-tests/tests/functional/test_runner/test_runner_by_name.ksh
+9-1scripts/zfs-tests.sh
+2-1tests/runfiles/common.run
+1-0tests/zfs-tests/tests/Makefile.am
+101-24 files

OpenZFS/src 7b3b320 — tests/zfs-tests/tests/functional/cli_root/zpool_iostat zpool_iostat_interval_some.ksh zpool_iostat_interval_all.ksh, tests/zfs-tests/tests/functional/delegate delegate_common.kshlib

ZTS: run cleanup when a test fails

These tests skip some of their cleanup when they fail, so a failure
leaves state behind for the tests after it:

- zpool_iostat_interval_all, zpool_iostat_interval_some, slog_014_pos:
  register the cleanup function, which they never did.
- inherit_001_pos: register default_cleanup_noexit, which was only
  called at the start of each configuration.
- delegate verify_fs_receive, verify_fs_receive_append: remove the
  stream files when the test fails, too.
- tmpfile_002_pos: remove the link when zpool freeze or export fails,
  so that tmpfile_003_pos does not find it.
- removal tests: stop the random writer when the test fails, before
  the pool is destroyed.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alan Somers <asomers at gmail.com>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Closes #20081
DeltaFile
+22-19tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib
+8-1tests/zfs-tests/tests/functional/tmpfile/tmpfile_002_pos.c
+5-0tests/zfs-tests/tests/functional/removal/removal.kshlib
+2-0tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh
+2-0tests/zfs-tests/tests/functional/cli_root/zpool_iostat/zpool_iostat_interval_some.ksh
+2-0tests/zfs-tests/tests/functional/cli_root/zpool_iostat/zpool_iostat_interval_all.ksh
+41-201 files not shown
+42-207 files

OpenZFS/src 57d13ba — module/os/linux/zfs zfs_dir.c zpl_inode.c, tests/test-runner/bin zts-report.py.in

linux: reuse stored names for normalized lookups

Resolve normalization-equivalent names to the stored dentry so that
removing or renaming one spelling cannot leave another cached spelling
accessible. Keep case sensitivity unchanged and discard negative
dentries that could hide a newly created equivalent name.

Warm both spellings in the native mixed-case deletion test.

Remove the Linux expected-failure entries for the four normalization
tests which now pass.

Assisted-by: OpenAI Codex
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: ooonea <35407790+ooonea at users.noreply.github.com>
Closes #13980
Closes #19726
DeltaFile
+12-3module/os/linux/zfs/zpl_super.c
+8-6module/os/linux/zfs/zpl_inode.c
+0-7tests/test-runner/bin/zts-report.py.in
+1-1module/os/linux/zfs/zfs_dir.c
+2-0tests/zfs-tests/tests/functional/casenorm/mixed_formd_delete.ksh
+23-175 files

OpenZFS/src 6a14755 — lib/libzfs/os/freebsd libzfs_zmount.c

libzfs: FreeBSD: retry an unmount a mount update holds busy

FreeBSD's dounmount() returns EBUSY while the mount has MNT_UPDATE
set, that is while any nmount(MNT_UPDATE) on it is in progress.
mountd(8) applies export changes that way, and libzfs signals mountd
in zfs_unmount() (zfs_commit_shares() after zfs_unshare()) right
before calling unmount(2).  So 'zfs unmount', 'zfs set canmount=off',
'zfs destroy' or 'zpool export' of a dataset with sharenfs=on could
fail with "pool or dataset is busy" when mountd's update of that file
system (from this or an earlier share change) overlapped the unmount.
This is the inheritance/inherit_001_pos failure on the FreeBSD CI
runners.  FreeBSD 14 calls VFS_MOUNT() (a ZFS remount) for each export
update as well, which makes the window wider there.

Retry unmount(2) on EBUSY with a short backoff (10 ms doubling, about
1.3 s in all).  A file system that is really busy still fails with
EBUSY, only later.

This makes zfs_unmount_remount_busy pass.

    [5 lines not shown]
DeltaFile
+17-3lib/libzfs/os/freebsd/libzfs_zmount.c
+17-31 files

OpenZFS/src 053ab1e — tests/runfiles freebsd.run, tests/zfs-tests/tests Makefile.am

ZTS: zfs unmount of a file system busy for a moment

On FreeBSD, unmount(2) returns EBUSY while another thread is inside
nmount(MNT_UPDATE) on the same mount.  mountd(8) does exactly that
whenever libzfs commits an NFS share change: it pushes the new export
list into the kernel with nmount(MNT_UPDATE).  'zfs unmount' of a
dataset with sharenfs=on signals mountd right before its own
unmount(2), so it races mountd's update of that very file system.
This is the "cannot unmount ...: pool or dataset is busy" failure of
'zfs set canmount=off' in inheritance/inherit_001_pos on the FreeBSD
CI runners.

zfs_unmount_remount_busy (FreeBSD only, about 3 s):
- a file system held busy by a process, released only once
  'zfs unmount' has had EBUSY and waits to try again, must unmount;
  without a retry this fails every time, independent of timing;
- 50 unmount/mount cycles while a background loop updates the mount
  (mount -u), as mountd does, must all succeed;
- a file system that stays in use must still refuse with "busy",

    [6 lines not shown]
DeltaFile
+172-0tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_remount_busy.ksh
+4-0tests/runfiles/freebsd.run
+1-0tests/zfs-tests/tests/Makefile.am
+177-03 files

OpenZFS/src fe2c5fe — include/sys spa_impl.h brt.h, module/zfs spa.c dbuf.c

Don't lose available space while block clones sync

A cloned block is charged in full to its dataset when it is born in
syncing context, and the BRT gives the same amount back as saved
space.  brt_pending_apply() adds the saved space at the start of
spa_sync(), but spa_dspace, which the open context space checks use,
is only recomputed at the end of spa_sync().  So from the first birth
to the end of the sync the pool is short by the whole size of the
data cloned in that txg: "available" can drop to 0, and creating,
writing or cloning a file fails with ENOSPC on a pool that has plenty
of space.  zpool_prefetch_002_pos hits this in CI when its clones of
a 100 MiB file on a 3 GiB pool split across txgs in the wrong place.

Count the saved space of the txg's new BRT references in
spa_brt_unborn, leave it out of brt_get_dspace(), and move each
block's share of it into spa_dspace as dbuf_write_done() sees the
block born, at the same time dsl_dataset_block_born() charges it.
What is left at the end of the sync belongs to clones that were freed
before they were born, so it is dropped before spa_update_dspace().

    [10 lines not shown]
DeltaFile
+76-9module/zfs/brt.c
+3-0module/zfs/dbuf.c
+2-0include/sys/brt.h
+1-0module/zfs/spa.c
+1-0include/sys/spa_impl.h
+83-95 files

OpenZFS/src 01368a9 — tests/runfiles common.run, tests/zfs-tests/tests Makefile.am

ZTS: available space while block clones sync

Cloned blocks are charged to their dataset when they are born in
syncing context, but the saved space the BRT gives back only reaches
the pool's dspace at the end of spa_sync().  Until then the pool looks
short by the whole size of the cloned data.  zpool_prefetch_002_pos
hit this in CI: its 50 clones of a 100 MiB file on a 3 GiB pool failed
with "open: .../clone.48: No space left on device".

block_cloning_avail_during_sync clones a 128 MiB file 16 times on a
1 GiB pool, holds the sync of the clones open with a zinject write
delay, and checks that the available space doesn't drop and a file
can be created while it runs.  Then it checks the space, the saved
space and the clones once the sync is done.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Will Rouesnel <wrouesnel at wrouesnel.com>
Closes #19812
DeltaFile
+135-0tests/zfs-tests/tests/functional/block_cloning/block_cloning_avail_during_sync.ksh
+2-1tests/runfiles/common.run
+1-0tests/zfs-tests/tests/Makefile.am
+138-13 files

OpenZFS/src 258d9d7 — lib/libzfs libzfs_sendrecv.c, tests/runfiles common.run

libzfs: estimate a clone's first snapshot from its origin

"zfs send -I <origin> <clone>@<snap>", and "zfs send -R" of a clone,
send the clone's first snapshot as an incremental from the clone's
origin: dump_snapshot() passes fromorigin to dump_ioctl(), and the
kernel takes the origin as the incremental source.  The -n and -v
estimate of that snapshot calls zfs_send_space() with no incremental
source, though, so it is the clone's full size and the snapshot is
printed as a full stream.  The total of a dry run, and the size a
verbose send reports its progress against, are too large by the size
of the origin.

Keep the origin of the filesystem being sent in dump_filesystem()
and, when fromorigin is set, use it as the incremental source of the
estimate and of the verbose line, as zfs_send_one() already does for
"zfs send -i <origin> <clone>@<snap>".

The origin was lost from the estimate when estimate_ioctl() was
replaced by zfs_send_space() in cf7684bc8.

    [7 lines not shown]
DeltaFile
+73-0tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_clone_estimate.ksh
+11-1lib/libzfs/libzfs_sendrecv.c
+3-2tests/runfiles/common.run
+1-0tests/zfs-tests/tests/Makefile.am
+88-34 files

OpenZFS/src 6a38552 — module/os/freebsd/zfs zfs_vfsops.c, module/os/linux/zfs zfs_dir.c zfs_vnops_os.c

Allow unmounting after zfs_resume_fs() fails

If zfs_resume_fs() fails after a rollback or receive, the filesystem
is meant to stay mounted but unusable until it's unmounted. Instead:

- On Linux, it can't be unmounted, so its pool can't be exported:
  - Reading /proc/self/mounts fails with EIO, for every process,
    since zpl_show_devname() can't enter the filesystem. umount(8),
    "zfs unmount" and "zpool export" all read it.
  - Unmounting waits forever for z_all_znodes to drain.
    zfs_suspend_fs() took an extra reference on every inode, and
    only the success path of zfs_resume_fs() drops it.
  - Writing back a dirty page leaves it locked, as zfs_putpage()
    returns without unlocking it when it can't enter the filesystem.
    Unmounting then hangs when it locks the page.
  - On debug builds, unmounting fails an assertion in
    zfs_unlinked_drain_stop_wait() that the filesystem isn't
    unmounted yet.
- On FreeBSD, the rollback or receive hangs. zfs_resume_fs() calls

    [16 lines not shown]
DeltaFile
+21-2module/os/linux/zfs/zfs_vfsops.c
+12-10module/os/freebsd/zfs/zfs_vfsops.c
+8-4module/os/linux/zfs/zpl_super.c
+3-1module/os/linux/zfs/zfs_vnops_os.c
+2-1module/os/linux/zfs/zfs_dir.c
+46-185 files

OpenZFS/src c11564a — tests/unit test_namecheck.c

unit/namecheck: cover the anymirror and anyraid pool names

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Christos Longros <longros at FreeBSD.org>
Closes #19897
DeltaFile
+2-0tests/unit/test_namecheck.c
+2-01 files

OpenZFS/src 6eea9e9 — module/zfs dmu_send.c

dmu_send: free the resume nvlist when setup_resume_points() fails

dmu_send_impl() allocates the nvl that carries the resume points
early, but the error path after setup_resume_points() jumps to out
without freeing it.  The raw-send error path right below frees nvl
before taking the same goto, so this path is just missing the same
call.  The leak is reached whenever a resumed or book-resumed send
fails there, e.g. from an invalid resume token.

Reviewed-by: Matthew Ahrens <matt at mahrens.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: HeonJe Lee <lhjnano at gmail.com>
Closes #19941
DeltaFile
+3-1module/zfs/dmu_send.c
+3-11 files