Tag zfs-2.2.7
META file and changelog updated.
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Fix race in libzfs_run_process_impl
When replacing a disk, a child process is forked to run a script called
zfs_prepare_disk (which can be useful for disk firmware update or health
check). The parent than calls waitpid and checks the child error/status
code.
However, the _reap_children thread (created from zed_exec_process to
manage zedlets) also waits for all children with the same PGID and can
stole the signal, causing the replace operation to be aborted.
As waitpid returns -1, the parent incorrectly assume that the child
process had an error or was killed. This, in turn, leaves the newly
added disk in REMOVED or UNAVAIL status rather than completing the
replace process.
This patch changes the PGID of the child process execuing the
prepare script, shielding it from the _reap_children thread.
[4 lines not shown]
Linux: Fix detection of register_sysctl_sz
Adjust the m4 function to mimic sentinel we use in spl-proc.c
This fixes the detection on kernels compiled with CONFIG_RANDSTRUCT=y
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <robn at despairlabs.com>
Reviewed-by: Pavel Snajdr <snajpa at snajpa.net>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Ivan Volosyuk <Ivan.Volosyuk at gmail.com>
Closes: #16620
Closes: #16805
OpenZFS/src 0bd8481 — include/os/linux/zfs/sys zfs_vnops_os.h, module/os/linux/zfs zfs_vnops_os.c zpl_export.c
add get_name implementation for exports. (#16833)
This fixes a serious performance problem with NFS handling of large
directories, as the new get_name code is much more efficient than the
default zfs_readdir. This is actually part of
20232ecfaa34177bef6c08f2f1a55b8c8bd20da4 in 2.3. But I've taken only
the minimum code to implement get_name, and not the rest of the long
name changes.
Signed-off-by: Charles Hedrick <hedrick at rutgers.edu>
Co-authored-by: Charles L. Hedrick <hedrick at ncommunis.cs.rutgers.edu>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Linux 6.12 compat: META
Update the META file to reflect compatibility with the 6.12 kernel.
Reviewed-by: Umer Saleem <usaleem at ixsystems.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #16793
BRT: Don't call brt_pending_remove() on holes/embedded
We are doing exactly the same checks around all brt_pending_add().
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Pawel Jakub Dawidek <pjd at FreeBSD.org>
Reviewed-by: Brian Atkinson <batkinson at lanl.gov>
Signed-off-by: Alexander Motin <mav at FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #16740
Pack dmu_buf_impl_t by 16 bytes
On 64bit FreeBSD this reduces one from 296 to 280 bytes. On small
block workloads dbufs may consume gigabytes of ARC, and this saves
5% of it.
Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Reviewed-by: Brian Atkinson <batkinson at lanl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Alexander Motin <mav at FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #16684
ZTS: Avoid embedded blocks in bclone/bclone_prop_sync
If we write less than 113 bytes with enabled compression we get
embeded block, which then fails check for number of cloned blocks
in bclone_test.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Pawel Jakub Dawidek <pjd at FreeBSD.org>
Reviewed-by: Brian Atkinson <batkinson at lanl.gov>
Signed-off-by: Alexander Motin <mav at FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #16740
Linux: Fix zfs_prune panics
by protecting against sb->s_shrink eviction on umount with newer kernels
deactivate_locked_super calls shrinker_free and only then
sops->kill_sb cb, resulting in UAF on umount when trying
to reach for the shrinker functions in zpl_prune_sb of
in-umount dataset
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Adam Moss <c at yotes.com>
Signed-off-by: Pavel Snajdr <snajpa at snajpa.net>
Closes #16770
FreeBSD: Add missing memory reclamation accounting
Signed-off-by: Alexander Motin <mav at FreeBSD.org>
Sponsored by: iXsystems, Inc.
Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Reviewed-by: Umer Saleem <usaleem at ixsystems.com>
Reviewed-by: Ameer Hamza <ahamza at ixsystems.com>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
FreeBSD: restore zfs_znode_update_vfs()
I accidentally removed this in c22d56e3e, and didn't notice because it
doesn't fail the build, but does fail to load into the kernel because it
can't link it.
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16554
OpenZFS/src 9e7af55 — include/os/freebsd/spl/sys debug.h, include/os/linux/spl/sys debug.h
Add custom debug printing for your asserts
Being able to print custom debug information on assert trip
seems useful.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Paul Dagnelie <pcd at delphix.com>
Signed-off-by: Rich Ercolani <rincebrain at gmail.com>
Closes #15792
freebsd: remove __FBSDID macro use
With FreeBSD's switch to git the $FreeBSD$ string is no longer expanded
and they have mostly been removed upstream. Stop using __FBSDID and
remove the no-longer needed sys/cdefs.h includes.
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Brooks Davis <brooks.davis at sri.com>
Closes #15527
OpenZFS/src ba4e582 — include/os/freebsd/spl/sys misc.h, module/os/freebsd/spl spl_misc.c
FreeBSD: Add const qualifier to members of struct opensolaris_utsname
These members have directly references to the global variables
exposed by the kernel. They are not going to be changed by this
kernel module.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Zhenlei Huang <zlei at FreeBSD.org>
Closes #16210
OpenZFS/src fc60e0c — include/os/freebsd/linux compiler.h, include/os/freebsd/spl/sys ccompat.h debug.h
freebsd: Use compiler.h from FreeBSD's base's linuxkpi
The FreeBSD linux/compiler.h in OpenZFS was copied from a very old
version of FreeBSD's linuxkpi's linux/compiler.h. There's no need for
this duplication. Use FreeBSD's linuxkpi version instead, and provide
zfs_fallthrough to augment it (it's all that's needed). Use #pragma once
to avoid naming issues for guard variables. Since this is a complete
rewrite, use my copyright here (the original code in FreeBSD still
credits everybody). This works back at least to FreeBSD 12.4, which
is not out of support, and all newer releases.
Remove extra copies of macros that were defined elsewhere, but are now
properly defined in LinuxKPI so are redundant.
Sponsored-by: Netflix
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Warner Losh <imp at bsdimp.com>
Closes #16650
Linux 6.12: FMODE_UNSIGNED_OFFSET is now FOP_UNSIGNED_OFFSET
torvalds/linux at 641bb4394f40 asserts that this is a static flag, not
intended to be variable per-file, so it moves it to
file_operations instead. We just change our check to follow.
No configure check is necessary because FOP_UNSIGNED_OFFSET didn't exist
before this commit, and FMODE_UNSIGNED_OFFSET flag is removed in the
same commit, so there's no chance of a conflict.
It's not clear to me that we need this check at all, as we never set
this flag on our own files, and I can't see any way that our llseek
handler could recieve a file from another filesystem. But, the whole
zpl_llseek() has a number of opportunities for pleasing cleanup that are
nothing to do with this change, so I'll leave that for a future change.
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16582
OpenZFS/src dbc70ec — config kernel-file.m4 kernel.m4, include/os/linux/kernel/linux vfs_compat.h
Linux 6.12: f_version removed from struct file
linux/torvalds at 11068e0b64cb removes it, suggesting this was a always
there as a helper to handle concurrent seeks, which all filesystems now
handle themselves if necessary.
Without looking into the mechanism, I can imagine how it might have been
used, but we have always set it to zero and never read from it,
presumably because we've always tracked per-caller position through the
znode anyway. So I don't see how there can be any functional change for
us by removing it. I've stayed conservative though and left it in for
older kernels, since its clearly not hurting anything there.
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16582
Linux 6.12: support 3arg dequeue_signal() without task param
See torvalds/linux at a2b80ce87a87. It claims the task arg is always
`current`, and so it is with us, so this is a safe change to make. The
only spanner is that we also support the older pre-5.17 3-arg
dequeue_signal() which had different meaning, so we have to check the
types to get the right one.
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16582
OpenZFS/src 63f70d3 — module/os/freebsd/zfs zfs_debug.c, module/os/linux/zfs zfs_debug.c
zfs_dbgmsg_print: make FreeBSD and Linux consistent
FreeBSD was using fprintf(), which might not be signal-safe. Meanwhile,
Linux's locking did not cover the header output. This two quirks are
unrelated, but both have the same response: be like the other one. So
with this commit, both functions are the same except for the names of
their lock and list variables.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #16181
Linux 6.12: avoid kmem_cache_create redefinition
torvalds/linux at b2e7456b5c25 makes kmem_cache_create() a macro, which
gets in the way of our our own redefinition, so we undef the macro first
for our own clients. This follows what we did for kmem_cache_alloc(),
see e951dba48.
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16582
OpenZFS/src 01e06ed — config kernel-mm-page-flags.m4 kernel.m4, include/os/linux/kernel/linux mm_compat.h
Linux 6.12: PG_error flag was removed
torvalds/linux at 09022bc196d2 removes the flag, and the corresponding
SetPageError() and ClearPageError() macros, with no replacement offered.
Going back through the upstream history, use of this flag has been
gradually removed over the last year as part of the long tail of
converting everything to folios. Interesting tidbit comments from
torvalds/linux at 29e9412b250e and torvalds/linux at 420e05d0de18 suggest that
this flag has not been used meaningfully since page writeback failures
started being recorded in errseq_t instead (the whole "fsyncgate" thing,
~2017, around torvalds/linux at 8ed1e46aaf1b).
Given that, it's possible that since perhaps Linux 4.13 we haven't been
getting anything by setting the flag. I don't know if that's true and/or
if there's something we should be doing instead, but my gut feel is that
its probably fine we only use the page cache as a proxy to allow mmap()
to work, rather than backing IO with it.
[8 lines not shown]
OpenZFS/src e580b54 — module Makefile.bsd, module/os/freebsd/zfs zfs_znode.c zfs_znode_os.c
zfs_znode: lift common code to a single shared file
For now, userspace has no znode implementation. Some of the property and
path handling code is used there though and is the same on all
platforms, so we only need a single copy of it.
Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #16492
[zfs-2.2.7] Add vdev_check_boot_reserve() to vdev.h
Add vdev_check_boot_reserve() to vdev.h for zfs-2.2.7 compatibility.
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
OpenZFS/src 4982943 — lib/libzpool zfs_debug.c vdev_label_os.c, module/os/freebsd/zfs zfs_debug.c
zfs_debug: specific variant for userspace
Just nice and simple, with room to grow.
Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
Closes #16492
zdb/ztest: send dbgmsg output to stderr
And, make the output fd an arg to zfs_dbgmsg_print(). This is a change
in behaviour, but keeps it consistent with where crash traces go, and
it's easy to argue this is what we want anyway; this is information
about the task, not the actual output of the task.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #16181
OpenZFS/src d845820 — include/os/freebsd/zfs/sys abd_os.h abd_impl_os.h, include/os/linux/zfs/sys abd_os.h abd_impl_os.h
abd_os: break out platform-specific header parts
Removing the platform #ifdefs from shared headers in favour of
per-platform headers. Makes abd_t much leaner, among other things.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #16253
value strings: pretty printers for flags and enums
This adds zfs_valstr, a collection of pretty printers for bitfields and
enums. These are useful in debugging, logging and other display contexts
where raw values are difficult for the untrained (or even trained!) eye
to decipher.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
OpenZFS/src 56a82c6 — config kernel-blk-queue.m4, include/os/linux/kernel/linux blkdev_compat.h
config: remove HAVE_BLK_QUEUE_FLAG_*
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16479
OpenZFS/src 9601eee — config kernel-blk-queue.m4, include/os/linux/kernel/linux blkdev_compat.h
config: remove HAVE_BLK_MQ
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16479
OpenZFS/src 517d491 — config kernel-wait.m4 kernel.m4, include/os/linux/spl/sys wait.h taskq.h
config: remove HAVE_WAIT_QUEUE_*
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16479