OpenZFS/src 1acd246module/zfs vdev.c

Fix readonly check for vdev user properties

VDEV_PROP_USERPROP is equal do VDEV_PROP_INVAL and so is not a real
property.  That's why vdev_prop_readonly() does not work right for
it.  In particular it may declare all vdev user properties readonly
on FreeBSD.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <robn at despairlabs.com>
Signed-off-by:  Alexander Motin <mav at FreeBSD.org>
Sponsored by:   iXsystems, Inc.
Closes #16890
DeltaFile
+1-1module/zfs/vdev.c
+1-11 files

OpenZFS/src 219a89clib/libzfs libzfs_changelist.c

Skip iterating over snapshots for share properties

Setting sharenfs and sharesmb properties on a dataset can become costly
if there are large number of snapshots, since setting the share
properties iterates over all snapshots present for a dataset. If it is
the root dataset for which we are trying to set the share property,
snapshots for all child datasets and their children will also be
iterated.

There is no need to iterate over snapshots for share properties
because we do not allow share properties or any other property,
to be set on a snapshot itself execpt for user properties.

This commit skips iterating over snapshots for share properties,
instead iterate over all child dataset and their children for share
properties.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Umer Saleem <usaleem at ixsystems.com>
Closes #16877
DeltaFile
+14-2lib/libzfs/libzfs_changelist.c
+14-21 files

OpenZFS/src f00a57acmd/zfs zfs_main.c

zfs_main: fix alignment on props usage output

I guess we've got some long property names since this was first set up!

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16883
DeltaFile
+16-16cmd/zfs/zfs_main.c
+16-161 files

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

CI: Fix FreeBSD 13.4 STABLE build

In #16869 we added FreeBSD 13.4 STABLE, but forget the special
thing, that the virtio nic within FreeBSD 13.x is buggy.

This fix adds the needed rtl8139 nic to the VM.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by:  Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs at mcmilk.de>
Closes #16885
DeltaFile
+1-0.github/workflows/scripts/qemu-2-start.sh
+1-01 files

OpenZFS/src ff7d051include/os/linux/spl/sys taskq.h, include/os/linux/zfs/sys abd_os.h

Fix compile-time warnings caused by duplicate struct typedefs (#16880)

Some compiler/versions warn these typedefs according to #16660.

The platform specific header sys/abd_os.h shouldn't define or use abd_t,
as it's defined in its non-platform specific consumer sys/abd.h.
Do the same as what FreeBSD header does.

Original-patch-by: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Signed-off-by: Rob Norris <robn at despairlabs.com>
(cherry picked from commit a9851ea3dd6af6f789e221f2ccd7ad43561eff81)

Co-authored-by: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
DeltaFile
+5-5include/os/linux/zfs/sys/abd_os.h
+1-0include/os/linux/spl/sys/taskq.h
+6-52 files

OpenZFS/src ab7cbbemodule/zcommon zpool_prop.c

zprop: fix value help for ZPOOL_PROP_CAPACITY

It's a percentage and documented as such, but we were showing it as
<size>.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16881 
DeltaFile
+1-1module/zcommon/zpool_prop.c
+1-11 files

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

CI: Add FreeBSD 14.2 RELEASE+STABLE builds

Update the CI to include FreeBSD 14.2 as a regularly tested platform.

Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #16869
DeltaFile
+10-10.github/workflows/scripts/qemu-2-start.sh
+5-4.github/workflows/zfs-qemu.yml
+15-142 files

OpenZFS/src 5c51f8fconfig kernel-kthread.m4, module/os/linux/spl spl-thread.c

config: fix dequeue_signal check for kernels <4.20

Before 4.20, kernel_siginfo_t was just called siginfo_t. This was
causing the kthread_dequeue_signal_3arg_task check, which uses
kernel_siginfo_t, to fail on older kernels.

In d6b8c17f1, we started checking for the "new" three-arg
dequeue_signal() by testing for the "old" version. Because that test is
explicitly using kernel_siginfo_t, it would fail, leading to the build
trying to use the new three-arg version, which would then not comile.

This commit fixes that by avoiding checking for the old 3-arg
dequeue_signal entirely. Instead, we check for the new one, as well as
the 4-arg form, and we use the old form as a fallback. This way, we
never have to test for it explicitly, and once we're building
HAVE_SIGINFO will make sure we get the right kernel_siginfo_t for it, so
everything works out nice.

Original-patch-by: Finix <yancw at info2soft.com>
Signed-off-by: Rob Norris <robn at despairlabs.com>
DeltaFile
+28-21config/kernel-kthread.m4
+3-3module/os/linux/spl/spl-thread.c
+31-242 files

OpenZFS/src 882a809config kernel-vfs-iov_iter.m4 kernel-pin-user-pages.m4, module/os/linux/zfs zfs_uio.c

Use pin_user_pages API for Direct I/O requests

As of kernel v5.8, pin_user_pages* interfaced were introduced. These
interfaces use the FOLL_PIN flag. This is preferred interface now for
Direct I/O requests in the kernel. The reasoning for using this new
interface for Direct I/O requests is explained in the kernel
documenetation:
Documentation/core-api/pin_user_pages.rst

If pin_user_pages_unlocked is available, the all Direct I/O requests
will use this new API to stay uptodate with the kernel API requirements.

Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Brian Atkinson <batkinson at lanl.gov>
Closes #16856
DeltaFile
+94-17module/os/linux/zfs/zfs_uio.c
+21-26config/kernel-vfs-iov_iter.m4
+33-0config/kernel-pin-user-pages.m4
+2-0config/kernel.m4
+150-434 files

OpenZFS/src c6442bdconfig kernel-vfs-direct_IO.m4 kernel-vfs-iov_iter.m4, include/os/linux/spl/sys uio.h

Removing old code outside of 4.18 kernsls

There were checks still in place to verify we could completely use
iov_iter's on the Linux side. All interfaces are available as of kernel
4.18, so there is no reason to check whether we should use that
interface at this point. This PR completely removes the UIO_USERSPACE
type. It also removes the check for the direct_IO interface checks.

Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Brian Atkinson <batkinson at lanl.gov>
Closes #16856
DeltaFile
+11-169module/os/linux/zfs/zfs_uio.c
+0-57config/kernel-vfs-direct_IO.m4
+7-45module/os/linux/zfs/zpl_file.c
+2-37config/kernel-vfs-iov_iter.m4
+5-12include/os/linux/spl/sys/uio.h
+1-2lib/libspl/include/sys/uio.h
+26-3221 files not shown
+26-3247 files

OpenZFS/src acda137module/zcommon simd_stat.c

simd_stat: fix undefined CONFIG_KERNEL_MODE_NEON error on armel

CONFIG_KERNEL_MODE_NEON depends on CONFIG_NEON. Neither is defined
on armel. Add a guard to avoid compilation errors.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Shengqi Chen <harry-chen at outlook.com>
Closes #16871
DeltaFile
+2-0module/zcommon/simd_stat.c
+2-01 files

OpenZFS/src 22259fbconfig kernel-xattr-handler.m4

Fix stray "no" in configure output

This is purely a cosmetic fix which removes a stray "no" from
the configure output.

Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Reviewed-by:  Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #16867
DeltaFile
+0-1config/kernel-xattr-handler.m4
+0-11 files

OpenZFS/src ff6266emodule/zfs vdev_raidz.c

Fix use-afer-free regression in RAIDZ expansion

We should not dereference rra after the last zio_nowait() is called.
It seems very unlikely, but ASAN in ztest managed to catch it.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by:  Alexander Motin <mav at FreeBSD.org>
Sponsored by:   iXsystems, Inc.
Closes #16868
DeltaFile
+2-2module/zfs/vdev_raidz.c
+2-21 files

OpenZFS/src 586304aetc/systemd/system zfs-mount.service.in

Remount datasets on soft-reboot

The one-shot zfs-mount.service is incorrectly deemed active by 
Systemd after a systemctl soft-reboot. As such, soft-rebooting
prevents zfs mount -a from being ran automatically.

This commit makes it so that zfs-mount.service is marked as being 
undone by the time umount.target is reached, so that zfs.target then 
pulls it in again and gets it restarted after a soft reboot.

Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: kotauskas <v.toncharov at gmail.com>
Closes #16845
DeltaFile
+7-0etc/systemd/system/zfs-mount.service.in
+7-01 files

OpenZFS/src 46e06femodule/os/freebsd/zfs vdev_geom.c, module/os/linux/zfs vdev_disk.c

flush: only detect lack of flush support in one place

It seems there's no good reason for vdev_disk & vdev_geom to explicitly
detect no support for flush and set vdev_nowritecache.  Instead, just
signal it by setting the error to ENOTSUP, and let zio_vdev_io_assess()
take care of it in one place.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #16855
DeltaFile
+0-15module/os/freebsd/zfs/vdev_geom.c
+3-3module/zfs/zio.c
+2-3module/os/linux/zfs/vdev_disk.c
+5-213 files

OpenZFS/src fbea924module/zfs zio.c

flush: don't report flush error when disabling flush support

The first time a device returns ENOTSUP in repsonse to a flush request,
we set vdev_nowritecache so we don't issue flushes in the future and
instead just pretend the succeeded. However, we still return an error
for the initial flush, even though we just decided such errors are
meaningless!

So, when setting vdev_nowritecache in response to a flush error, also
reset the error code to assume success.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <mav at FreeBSD.org>
Signed-off-by: Rob Norris <rob.norris at klarasystems.com>
Closes #16855
DeltaFile
+5-2module/zfs/zio.c
+5-21 files

OpenZFS/src 76f57abconfig zfs-build.m4

build: use correct bashcompletiondir on arch

Reviewed-by: Tino Reichardt <milky-zfs at mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: poscat <poscat at poscat.moe>
Closes #16861 
DeltaFile
+1-1config/zfs-build.m4
+1-11 files

OpenZFS/src ecc0970lib/libspl backtrace.c

backtrace: fix off-by-one on string output

sizeof("foo") includes the trailing null byte, so all the output had
nulls through it. Most terminals quietly ignore it, but it makes some
tools misdetect file types and other annoyances.

Easy fix: subtract 1.

Sponsored-by: https://despairlabs.com/sponsor/
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>
Closes #16862 
DeltaFile
+1-1lib/libspl/backtrace.c
+1-11 files

OpenZFS/src 7cbe7bb. META

Tag 2.3.0-rc4

Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
DeltaFile
+1-1META
+1-11 files

OpenZFS/src 3887591module/zfs brt.c

BRT: Check bv_mos_entries in brt_entry_lookup()

When vdev first sees some block cloning, there is a window when
brt_maybe_exists() might already return true since something was
cloned, but bv_mos_entries is still 0 since BRT ZAP was not yet
created.  In such case we should not try to look into the ZAP
and dereference NULL bv_mos_entries_dnode.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <robn at despairlabs.com>
Signed-off-by:  Alexander Motin <mav at FreeBSD.org>
Sponsored by:   iXsystems, Inc.
Closes #16851 
DeltaFile
+3-0module/zfs/brt.c
+3-01 files

OpenZFS/src 2dcc8femodule/zfs dbuf.c

Fix DR_OVERRIDDEN use-after-free race in dbuf_sync_leaf

In dbuf_sync_leaf, we clone the arc_buf in dr if we share it with db
except for overridden case. However, this exception causes a race where
dbuf_new_size could free the arc_buf after the last dereference of
*datap and causes use-after-free. We fix this by cloning the buf
regardless if it's overridden.

The race:
--
P0                                     P1

                                       dbuf_hold_impl()
                                         // dbuf_hold_copy passed
                                         // because db_data_pending NULL

dbuf_sync_leaf()
  // doesn't clone *datap
  // *datap derefed to db_buf

    [37 lines not shown]
DeltaFile
+1-2module/zfs/dbuf.c
+1-21 files

OpenZFS/src 6c9b4f1module/zfs dbuf.c

Fix DR_OVERRIDDEN use-after-free race in dbuf_sync_leaf

In dbuf_sync_leaf, we clone the arc_buf in dr if we share it with db
except for overridden case. However, this exception causes a race where
dbuf_new_size could free the arc_buf after the last dereference of
*datap and causes use-after-free. We fix this by cloning the buf
regardless if it's overridden.

The race:
--
P0                                     P1

                                       dbuf_hold_impl()
                                         // dbuf_hold_copy passed
                                         // because db_data_pending NULL

dbuf_sync_leaf()
  // doesn't clone *datap
  // *datap derefed to db_buf

    [37 lines not shown]
DeltaFile
+1-2module/zfs/dbuf.c
+1-21 files

OpenZFS/src 19a04e5module/zfs brt.c

BRT: Check bv_mos_entries in brt_entry_lookup()

When vdev first sees some block cloning, there is a window when
brt_maybe_exists() might already return true since something was
cloned, but bv_mos_entries is still 0 since BRT ZAP was not yet
created.  In such case we should not try to look into the ZAP
and dereference NULL bv_mos_entries_dnode.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Rob Norris <robn at despairlabs.com>
Signed-off-by:  Alexander Motin <mav at FreeBSD.org>
Sponsored by:   iXsystems, Inc.
Closes #16851 
DeltaFile
+3-0module/zfs/brt.c
+3-01 files

OpenZFS/src 0d51852lib/libspl atomic.c, module/os/freebsd/zfs sysctl_os.c

Remove unnecessary CSTYLED escapes on top-level macro invocations

cstyle can handle these cases now, so we don't need to disable it.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16840
DeltaFile
+0-82module/os/freebsd/zfs/sysctl_os.c
+0-28lib/libspl/atomic.c
+2-5module/os/linux/zfs/zvol_os.c
+2-4module/zfs/spa_log_spacemap.c
+0-6module/zfs/spa.c
+0-6module/zcommon/zfs_valstr.c
+4-13137 files not shown
+5-19643 files

OpenZFS/src 87947f2scripts cstyle.pl

cstyle: understand macro params can be empty

It's not uncommon to have empty parameters in code generator macros,
usually when multiple parameters are concatenated or stringified into a
single token or literal. So, exclude the space-before-comma check, which
will allow construction like `MACRO_CALL(foo, , baz)`.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16840
DeltaFile
+3-1scripts/cstyle.pl
+3-11 files

OpenZFS/src 0e87150scripts cstyle.pl

cstyle: understand basic top-level macro invocations

We quite often invoke macros outside of functions, usually to generate
functions or data. cstyle inteprets these as function headers, which at
least have opinions for indenting.

This introduces a separate state for top-level macro invocations, and
excludes it from matching functions. For the moment, most of the
existing rules will continue to apply, but this gives us a way to add or
removes rules targeting macros specifically.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16840
DeltaFile
+16-1scripts/cstyle.pl
+16-11 files

OpenZFS/src 7742e29cmd/zpool zpool_main.c, module/zfs vdev_raidz.c

Optimize RAIDZ expansion

- Instead of copying one ashift-sized block per ZIO, copy as much
as we have contiguous data up to 16MB per old vdev.  To avoid data
moves use gang ABDs, so that read ZIOs can directly fill buffers
for write ZIOs.  ABDs have much smaller overhead than ZIOs in both
memory usage and processing time, plus big I/Os do not depend on
I/O aggregation and scheduling to reach decent performance on HDDs.
 - Reduce raidz_expand_max_copy_bytes to 16MB on 32bit platforms.
 - Use 32bit range tree when possible (practically always now) to
slightly reduce memory usage.
 - Use ZIO_PRIORITY_REMOVAL for early stages of expansion, same as
for main ones.
 - Fix rate overflows in `zpool status` reporting.

With these changes expanding RAIDZ1 from 4 to 5 children I am able
to reach 6-12GB/s rate on SSDs and ~500MB/s on HDDs, both are
limited by devices instead of CPU.


    [4 lines not shown]
DeltaFile
+119-57module/zfs/vdev_raidz.c
+2-4cmd/zpool/zpool_main.c
+121-612 files

OpenZFS/src 73a73cbscripts cstyle.pl

cstyle: ignore old non-POSIX types in macro invocations

In code generation macros, we often use names like `uint` when
constructing handler functions. These are not being used as types, so
exclude them from the admonishment to use POSIX type names.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16840
DeltaFile
+4-1scripts/cstyle.pl
+4-11 files

OpenZFS/src e0039c7lib/libspl atomic.c, module/os/freebsd/zfs sysctl_os.c

Remove unnecessary CSTYLED escapes on top-level macro invocations

cstyle can handle these cases now, so we don't need to disable it.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16840
DeltaFile
+0-82module/os/freebsd/zfs/sysctl_os.c
+0-28lib/libspl/atomic.c
+2-5module/os/linux/zfs/zvol_os.c
+2-4module/zfs/spa_log_spacemap.c
+0-6module/zcommon/zfs_valstr.c
+0-6module/zfs/spa.c
+4-13137 files not shown
+5-19643 files

OpenZFS/src 0de8ae5scripts cstyle.pl

cstyle: ignore old non-POSIX types in macro invocations

In code generation macros, we often use names like `uint` when
constructing handler functions. These are not being used as types, so
exclude them from the admonishment to use POSIX type names.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Rob Norris <robn at despairlabs.com>
Closes #16840
DeltaFile
+4-1scripts/cstyle.pl
+4-11 files