ZFS on Linux/src f95704cmodule/zcommon zfs_prop.c zfeature_common.c, module/zfs zio_checksum.c

Disable EDONR on FreeBSD

FreeBSD uses its own crypto framework in-kernel which, at this time,
has no EDONR implementation.

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Allan Jude <allanjude at freebsd.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan at ixsystems.com>
Closes #9664 

ZFS on Linux/src 054a049include/sys/fs zfs.h, tests/zfs-tests/cmd/libzfs_input_check libzfs_input_check.c

Add ZFS_IOC offsets for FreeBSD

FreeBSD requires three additional ioctls, they are ZFS_IOC_NEXTBOOT,
ZFS_IOC_JAIL, and ZFS_IOC_UNJAIL.  These have been added after the
Linux-specific ioctls.  The range 0x80-0xFF has been reserved for 
future optional platform-specific ioctls.  Any platform may choose
to implement these as appropriate.

None of the existing ioctl numbers have been changed to maintain
compatibility.  For Linux no vectors have been registered for the
new ioctls and they are reported as unsupported.

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Allan Jude <allanjude at freebsd.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9667 

ZFS on Linux/src e64e84einclude/sys spa_impl.h spa.h, module/os/linux/zfs spa_misc_os.c

Refactor deadman set failmode to be cross platform

Update zfs_deadman_failmode to use the ZFS_MODULE_PARAM_CALL
wrapper, and split the common and platform specific portions.

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9670 

ZFS on Linux/src 2a8ba60module/zfs vdev_indirect_mapping.c dbuf.c

Replace ASSERTV macro with compiler annotation

Remove the ASSERTV macro and handle suppressing unused 
compiler warnings for variables only in ASSERTs using the 
__attribute__((unused)) compiler annotation.  The annotation
is understood by both gcc and clang.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9671 

ZFS on Linux/src 12395c7cmd/arc_summary arc_summary3

Fix reporting of L2ARC hits/misses in arc_summary3

arc_summary3 reports L2ARC hits and misses as Bytes, whereas they
should be reported as events. arc_summary2 reports these correctly.

Reviewed-by: Ryan Moeller <ryan at ixsystems.com>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: George Amanakis <gamanakis at gmail.com>
Closes #9669 

ZFS on Linux/src be627fcinclude/os/linux/zfs/sys zfs_context_os.h, include/sys zfs_context.h

Refactor zfs_context.h to build on FreeBSD

- on Linux move Linux specific headers to zfs_context_os.h
- on FreeBSD move FreeBSD specific definitions to zfs_context_os.h
- remove duplicate tsd_ definitions
- remove unused AT_TYPE

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Don Brady <don.brady at delphix.com>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9668 

ZFS on Linux/src 618b6adtests/zfs-tests/include libtest.shlib properties.shlib, tests/zfs-tests/tests/functional/cli_root/zfs_set property_alias_001_pos.ksh

Refactor compression algorithm selection for tests

- Moves compression algorithms for tests to properties.shlib
- Removes all compression algorithms levels from general tests
- Replaces on with lz4 for compression tests
- Removes random algorithm selection, if not needed
- Cleans copyright header formatting

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: John Kennedy <john.kennedy at delphix.com>
Reviewed-by: Michael Niewöhner <foss at mniewoehner.de>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld at schouten-lebbing.nl>
Closes #9645 

ZFS on Linux/src 5a08977cmd/zdb zdb.c

Fix zdb_read_block using zio after it is destroyed

The checksum display code of zdb_read_block uses a zio
to read in the block and then calls zio_checksum_compute.
Use a new zio in the call to zio_checksum_compute not the zio
from the read which has been destroyed by zio_wait.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Igor Kozhukhov <igor at dilos.org>
Signed-off-by: Paul Zuchowski <pzuchowski at datto.com>
Closes #9644
Closes #9657 
DeltaFile
+6-1cmd/zdb/zdb.c
+6-11 files

ZFS on Linux/src 54c8366module/icp/algs/modes gcm.c, module/icp/core kcf_prov_lib.c

ICP: Fix null pointer dereference and use after free

In gcm_mode_decrypt_contiguous_blocks(), if vmem_alloc() fails,
bcopy is called with a NULL pointer destination and a length > 0.
This results in undefined behavior. Further ctx->gcm_pt_buf is
freed but not set to NULL, leading to a potential write after
free and a double free due to missing return value handling in
crypto_update_uio(). The code as is may write to ctx->gcm_pt_buf
in gcm_decrypt_final() and may free ctx->gcm_pt_buf again in
aes_decrypt_atomic().

The fix is to slightly rework error handling and check the return
value in crypto_update_uio().

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tom Caputi <tcaputi at datto.com>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: Attila Fülöp <attila at fueloep.org>
Closes #9659 

ZFS on Linux/src 7af7286.github codecov.yml

Codecov tweaks

Modify the Codecov settings to provide a more realistic and stable
report.  The following change were made:

- Precision has been limited to whole percents only, but will round
  to nearest. This means 0.0-0.49 will round to zero (no change) and
  0.51 will round to 1%.

- Exclude the tests/zfs-tests directory from the report.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld at schouten-lebbing.nl>
Closes #9650 

ZFS on Linux/src 5ff2249module/zfs arc.c

Fix use-after-free in case of L2ARC prefetch failure

In case L2ARC read failed, l2arc_read_done() creates _different_ ZIO
to read data from the original storage device.  Unfortunately pointer
to the failed ZIO remains in hdr->b_l1hdr.b_acb->acb_zio_head, and if
some other read try to bump the ZIO priority, it will crash.

The problem is reproducible by corrupting L2ARC content and reading
some data with prefetch if l2arc_noprefetch tunable is changed to 0.
With the default setting the issue is probably not reproducible now.

Reviewed-by: Tom Caputi <tcaputi at datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Alexander Motin <mav at FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #9648 
DeltaFile
+16-3module/zfs/arc.c
+16-31 files

ZFS on Linux/src 624222alib/libzfs libzfs_dataset.c, man/man8 zfsprops.8

Increase allowed 'special_small_blocks' maximum value

There may be circumstances where it's desirable that all blocks
in a specified dataset be stored on the special device.  Relax
the artificial 128K limit and allow the special_small_blocks
property to be set up to 1M.  When blocks >1MB have been enabled
via the zfs_max_recordsize module option, this limit is increased
accordingly.

Reviewed-by: Don Brady <don.brady at delphix.com>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #9131
Closes #9355 

ZFS on Linux/src b367334module/zcommon zfs_fletcher.c, module/zfs vdev_raidz_math.c

Wrap module_param_call() routines under __linux__

The module_param_call() functionality is currently still
Linux-specific and should be wrapped accordingly.

Reviewed-by: Allan Jude <allanjude at freebsd.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9666 

ZFS on Linux/src bff8fb3module/zfs dmu_diff.c

Mark write_record static

The write_record() function is private and should be marked as such.

Reviewed-by: Allan Jude <allanjude at freebsd.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9665 

ZFS on Linux/src 74d1d74include/os/linux/spl/sys sysmacros.h, module/lua ltablib.c

Move linux qsort def to platform header

Moving qsort to the platform header allows each platform to
provide an appropriate sorting implementation.

Reviewed-by: Allan Jude <allanjude at freebsd.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9663 

ZFS on Linux/src e69bb31. .gitignore, module .gitignore

Adapt gitignore for modules

Remove the specific gitignore rules for module left-overs and add a
generic one in modules/.

Reviewed-by: Ryan Moeller <ryan at ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: Michael Niewöhner <foss at mniewoehner.de>
Closes #9656 
DeltaFile
+0-12.gitignore
+1-0module/.gitignore
+1-122 files

ZFS on Linux/src 5142032include/sys zfs_ioctl_impl.h, module/os/linux/zfs zfs_ioctl_os.c

Move zfs_cmd_t copyin/copyout to platform code

FreeBSD needs to cope with multiple version of the zfs_cmd_t
structure. Allowing the platform code to pre and post
process the cmd structure makes it possible to work with
legacy tooling.

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9624 

ZFS on Linux/src 42a826einclude/sys mntent.h

Add FreeBSD required defines to mntent.h

Linux and FreeBSD use different names for suid / setuid.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9632 

ZFS on Linux/src 758699bmodule/nvpair nvpair.c

Restructure nvlist_nv_alloc to work on FreeBSD

KM_PUSHPAGE is an Illumosism - On FreeBSD it's
aliased to the same malloc flag as KM_SLEEP.
The compiler naturally rejects multiple case
statements with the same value.  This is effectively
a no-op since all callers pass a specific KM_* flag.

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9643 

ZFS on Linux/src 101f9b1cmd/arc_summary arc_summary3 arc_summary2, cmd/arcstat arcstat

Add FreeBSD code to arc_summary and arcstat

Adding the FreeBSD code allows arc_summary and arcstat
to be used on FreeBSD.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Ryan Moeller <ryan at ixsystems.com>
Closes #9641 

ZFS on Linux/src c54687clib/libspl/asm-x86_64 atomic.S

Make asm-x86_64/atomic.S build on FreeBSD

Include the required headers for FreeBSD.

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9634 

ZFS on Linux/src f348c78lib/libzpool kernel.c, module/os/linux/zfs vdev_file.c

Mark Linux fallocate extensions as specific to Linux

fallocate(2) is a Linux-specific system call which in unavailable
on other platforms.

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9633 

ZFS on Linux/src 77323bcinclude/sys zio_crypt.h

Add FreeBSD support to zio_crypto.h

Minimal compatibility changes for FreeBSD.

Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9631 

ZFS on Linux/src a5b762ainclude/sys zfs_ioctl.h, module/os/linux/zfs zfs_ioctl_os.c

Resolve ZoF differences in zfs_ioctl.h

FreeBSD needs to be able to pass the jail id to the jail/unjail ioctls
and the struct file in the device structure is unused.

Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9625 

ZFS on Linux/src a7c3588tests/zfs-tests/tests/functional/cli_root/zpool_attach attach-o_ashift.ksh

ZTS: Fix attach-o_ashift.ksh for multiple platforms

The `-o ashift` option must appear after attach to be properly
interpreted by getopt(3) on all platforms.

Reviewed-by: Richard Elling <Richard.Elling at RichardElling.com>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Ryan Moeller <ryan at ixsystems.com>
Signed-off-by: Igor Kozhukhov <igor at dilos.org>
Closes #9636 

ZFS on Linux/src d6f67dfinclude/os/linux/spl/sys uio.h, include/sys abd.h zfs_project.h

Minor diff reduction with ZoF in include/sys

- move linux/ includes to platform headers
- add void * io_bio to zio for tracking the underlying bio
- add freebsd specific fields to abd_scatter

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9615 

ZFS on Linux/src c940bf0etc/systemd/system-generators zfs-mount-generator.in

Fix encryption logic in systemd mount generator

Previously the generator would skip a dataset if it wasn't mountable by
'zfs mount -a' (legacy/none mountpoint, canmount off/noauto). This also
skipped the generation of key-load units for such datasets, breaking
the dependency handling for mountable child datasets.

Reviewed-by: Antonio Russo <antonio.e.russo at gmail.com>
Reviewed-by: Richard Laager <rlaager at wiktel.com>
Signed-off-by: InsanePrawn <insane.prawny at gmail.com>
Closes #9611

ZFS on Linux/src 70d2dd9etc/systemd/system-generators zfs-mount-generator.in

Fix non-absolute path in systemd mount generator

Systemd will ignore units that try to execute programs from non-absolute
paths. Use hardcoded /bin/sh instead.

Reviewed-by: Antonio Russo <antonio.e.russo at gmail.com>
Reviewed-by: Richard Laager <rlaager at wiktel.com>
Signed-off-by: InsanePrawn <insane.prawny at gmail.com>
Closes #9611

ZFS on Linux/src d8ce455etc/systemd/system-generators zfs-mount-generator.in

Fix small typo in systemd mount generator

Reviewed-by: Antonio Russo <antonio.e.russo at gmail.com>
Reviewed-by: Richard Laager <rlaager at wiktel.com>
Signed-off-by: InsanePrawn <insane.prawny at gmail.com>
Closes #9611

ZFS on Linux/src 7c1bf0clib/libspl/include assert.h, lib/libzpool kernel.c

Implement -A (ignore ASSERTs) for zdb

The command line switch -A (ignore ASSERTs) has always been available 
in zdb but was never connected up to the correct global variable.

There are times when you need zdb to ignore asserts and keep dumping 
out whatever information it can get despite the ASSERT(s) failing. 
It was always intended to be part of zdb but was incomplete.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski at datto.com>
Closes #9610 

ZFS on Linux/src 9e17e6fconfig kernel-elevator-change.m4 kernel.m4, include/os/linux/kernel/linux blkdev_compat.h

Remove zfs_vdev_elevator module option

As described in commit f81d5ef6 the zfs_vdev_elevator module
option is being removed.  Users who require this functionality
should update their systems to set the disk scheduler using a
udev rule.

Reviewed-by: Richard Laager <rlaager at wiktel.com>
Reviewed-by: loli10K <ezomori.nozomu at gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Issue #8664
Closes #9417
Closes #9609 

ZFS on Linux/src 3c819a2module/zfs dsl_scan.c vdev.c, tests/zfs-tests/tests/functional/resilver resilver_restart_001.ksh resilver.cfg

Prevent unnecessary resilver restarts

If a device is participating in an active resilver, then it will have a
non-empty DTL. Operations like vdev_{open,reopen,probe}() can cause the
resilver to be restarted (or deferred to be restarted later), which is
unnecessary if the DTL is still covered by the current scan range. This
is similar to the logic in vdev_dtl_should_excise() where the DTL can
only be excised if it's max txg is in the resilvered range.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: John Gallagher <john.gallagher at delphix.com>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: John Poduska <jpoduska at datto.com>
Issue #840 
Closes #9155
Closes #9378
Closes #9551
Closes #9588 

ZFS on Linux/src 894f669cmd/zdb zdb.c, man/man8 zdb.8

Add display of checksums to zdb -R

The function zdb_read_block (zdb -R) was always intended to have a :c 
flag which would read the DVA and length supplied by the user, and 
display the checksum. Since we don't know which checksum goes with 
the data, we should calculate and display them all.

For each checksum in the table, read in the data at the supplied 
DVA:length, calculate the checksum, and display it. Update the man 
page and create a zfs test for the new feature.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: Paul Zuchowski <pzuchowski at datto.com>
Closes #9607 

ZFS on Linux/src 0c46813module/os/linux/zfs zfs_znode.c

Check for unlinked znodes after igrab()

The changes in commit 41e1aa2a / PR #9583 introduced a regression on
tmpfile_001_pos: fsetxattr() on a O_TMPFILE file descriptor started
to fail with errno ENODATA:

    openat(AT_FDCWD, "/test", O_RDWR|O_TMPFILE, 0666) = 3
    <...>
    fsetxattr(3, "user.test", <...>, 64, 0) = -1 ENODATA

The originally proposed change on PR #9583 is not susceptible to it,
so just move the code/if-checks around back in that way, to fix it.

Reviewed-by: Pavel Snajdr <snajpa at snajpa.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Original-patch-by: Heitor Alves de Siqueira <halves at canonical.com>
Signed-off-by: Mauricio Faria de Oliveira <mfo at canonical.com>
Closes #9602 

ZFS on Linux/src da92d5cinclude/os/linux/spl/sys vnode.h, lib/libzpool kernel.c

Add zfs_file_* interface, remove vnodes

Provide a common zfs_file_* interface which can be implemented on all 
platforms to perform normal file access from either the kernel module
or the libzpool library.

This allows all non-portable vnode_t usage in the common code to be 
replaced by the new portable zfs_file_t.  The associated vnode and
kobj compatibility functions, types, and macros have been removed
from the SPL.  Moving forward, vnodes should only be used in platform
specific code when provided by the native operating system.

Reviewed-by: Sean Eric Fagan <sef at ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Igor Kozhukhov <igor at dilos.org>
Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Signed-off-by: Matt Macy <mmacy at FreeBSD.org>
Closes #9556 

ZFS on Linux/src 67a6c3btests/zfs-tests/tests/functional/channel_program/synctask_core tst.terminate_by_signal.ksh

ZTS: tst.terminate_by_signal increase test threshold

The tst.terminate_by_signal test case may occasionally fail when
running in a less consistent virtual environment.  For all observed
failures the process was terminated correctly but it took longer than
expected resulting in too many snapshot being created.

To minimize the likelyhood of this occuring increase the threshold
from 50 to 90 snapshots.  The larger limit will still verifiy that
the channel program was correctly terminated early.

Reviewed-by: Don Brady <don.brady at delphix.com>
Reviewed-by: Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #9601 

ZFS on Linux/src 540312dtests/test-runner/bin zts-report.py, tests/zfs-tests/tests/functional/casenorm casenorm.cfg casenorm.kshlib

ZTS: Casenorm fix unicode interpretation

Use `printf` to properly interpret unicode characters.

Illumos uses a utility called `zlook` to allow additional flags to be 
provided to readdir and lookup for testing.  This functionality could 
be ported to Linux, but even without it several of the tests can be 
enabled by instead using the standard `test` command.

Additional, work is required to enable the remaining test cases.

Reviewed-by: Igor Kozhukhov <igor at dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: George Melikov <mail at gmelikov.ru>
Issue #7633 
Closes #8812 

ZFS on Linux/src 8221bcfcmd/zfs zfs_main.c, tests/zfs-tests/tests/functional/cli_root/zfs_get zfs_get_009_pos.ksh zfs_get_list_d.kshlib

Remove requirement for -d 1 for zfs list and zfs get with bookmarks

df58307 removed the need to specify -d 1 when zfs list and zfs get are
called with -t snapshot on a datset. This commit extends the same
behaviour to -t bookmark.

This commit also introduces the 'snap' shorthand for snapshots from
zfs list to zfs get.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tom Caputi <tcaputi at datto.com>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: InsanePrawn <insane.prawny at gmail.com>
Closes #9589 

ZFS on Linux/src 7ae3f8dconfig kernel-dentry-operations.m4, include/os/linux/zfs/sys zpl.h

Partially revert 5a6ac4c

Reinstate the zpl_revalidate() functionality to resolve a regression
where dentries for open files during a rollback are not invalidated.

The unrelated functionality for automatically unmounting .zfs/snapshots
was not reverted.  Nor was the addition of shrink_dcache_sb() to the
zfs_resume_fs() function.

This issue was not immediately caught by the CI because the test case
intended to catch it was included in the list of ZTS tests which may
occasionally fail for unrelated reasons.  Remove all of the rollback
tests from this list to help identify the frequency of any spurious
failures.

The rollback_003_pos.ksh test case exposes a real issue with the
long standing code which needs to be investigated.  Regardless,
it has been enable with a small workaround in the test case itself.

Reviewed-by: Matt Ahrens <matt at delphix.com>
Reviewed-by: Pavel Snajdr <snajpa at snajpa.net>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #9587
Closes #9592 

ZFS on Linux/src 41e1aa2module/os/linux/zfs zfs_znode.c

Break out of zfs_zget early if unlinked znode

If zp->z_unlinked is set, we're working with a znode that has been
marked for deletion. If that's the case, we can skip the "goto again"
loop and return ENOENT, as the znode should not be discovered.

Reviewed-by: Richard Yao <ryao at gentoo.org>
Reviewed-by: Matt Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Heitor Alves de Siqueira <halves at canonical.com>
Closes #9583 

ZFS on Linux/src cc1a1e1lib/libzfs libzfs_dataset.c

Remove inappropiate error message suggesting to use '-r'

Removes an incorrect error message from libzfs that suggests applying
'-r' when a zfs subcommand is called with a filesystem path while
expecting either a snapshot or bookmark path.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: InsanePrawn <insane.prawny at gmail.com>
Closes #9574 

ZFS on Linux/src 64c77c4man/man8 zfs-mount-generator.8.in

Change zed.service to zfs-zed.service in man page

zed.service does not exist
replaced with correct service name in man.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld at schouten-lebbing.nl>
Closes #9581 

ZFS on Linux/src 7ba964cmodule/os/linux/zfs vdev_disk.c

Prevent NULL pointer dereference in blkg_tryget() on EL8 kernels

blkg_tryget() as shipped in EL8 kernels does not seem to handle NULL
@blkg as input; this is different from its mainline counterpart where
NULL is accepted.  To prevent dereferencing a NULL pointer when dealing
with block devices which do not set a root_blkg on the request queue
perform the NULL check in vdev_bio_associate_blkg().

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #9546 
Closes #9577 

ZFS on Linux/src 6d948c3include/os/linux/spl/sys kmem_cache.h, include/sys zfs_context.h

Add kmem_cache flag for forcing kvmalloc

This adds a new KMC_KVMEM flag was added to enforce use of the
kvmalloc allocator in kmem_cache_create even for large blocks, which
may also increase performance in some specific cases (e.g. zstd), too.

Default to KVMEM instead of VMEM in spl_kmem_cache_create.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matt Ahrens <matt at delphix.com>
Signed-off-by: Sebastian Gottschall <s.gottschall at dd-wrt.com>
Signed-off-by: Michael Niewöhner <foss at mniewoehner.de>
Closes #9034

ZFS on Linux/src 8aaa10amodule/os/linux/spl spl-kmem.c

Check for __GFP_RECLAIM instead of GFP_KERNEL

Check for __GFP_RECLAIM instead of GFP_KERNEL because zfs modifies
IO and FS flags which breaks the check for GFP_KERNEL.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matt Ahrens <matt at delphix.com>
Reviewed-by: Sebastian Gottschall <s.gottschall at dd-wrt.com>
Signed-off-by: Michael Niewöhner <foss at mniewoehner.de>
Closes #9034

ZFS on Linux/src 6695588config kernel-kmem.m4 kernel.m4, include/os/linux/spl/sys kmem.h

Make use of kvmalloc if available and fix vmem_alloc implementation

This patch implements use of kvmalloc for GFP_KERNEL allocations, which
may increase performance if the allocator is able to allocate physical
memory, if kvmalloc is available as a public kernel interface (since
v4.12). Otherwise it will simply fall back to virtual memory (vmalloc).

Also fix vmem_alloc implementation which can lead to slow allocations
since the first attempt with kmalloc does not make use of the noretry
flag but tells the linux kernel to retry several times before it fails.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matt Ahrens <matt at delphix.com>
Signed-off-by: Sebastian Gottschall <s.gottschall at dd-wrt.com>
Signed-off-by: Michael Niewöhner <foss at mniewoehner.de>
Closes #9034

ZFS on Linux/src c025008module/os/linux/spl spl-kmem-cache.c

Add missing documentation for some KMC flags

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matt Ahrens <matt at delphix.com>
Signed-off-by: Sebastian Gottschall <s.gottschall at dd-wrt.com>
Signed-off-by: Michael Niewöhner <foss at mniewoehner.de>
Closes #9034

ZFS on Linux/src 94a570elib/libzfs libzfs_pool.c

Fix `zpool create -o <property>` error message

When `zpool create -o <property>` is run without root permissions
and the pool property requested is not specifically enumerated in
zpool_valid_proplist().  Then an incorrect error message referring
to an invalid property is printed rather than the expected permission
denied error.

Specifying a pool property at create time should be handled the same
way as filesystem properties in zfs_valid_proplist().  There should
not be default zfs_error_aux() set for properties which are not
listed.

Reviewed-by: loli10K <ezomori.nozomu at gmail.com>
Reviewed-by: Kjeld Schouten <kjeld at schouten-lebbing.nl>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #9550 
Closes #9568 

ZFS on Linux/src c5ebfbbman/man8 zpool.8 zpoolconcepts.8

Reorganize zpool(8) man page into sections

Moved subcommand topics into individual manpages. Reordered and 
grouped the list of subcommands by topic.

Moved concepts overview to `zpoolconcepts.8` and the long list of
available pool properties to `zpoolprops.8`.

Internal cross-references copied from `zpool.8` needed to be 
converted to `.Xr` external references to new subcommand manual 
pages.

Move `autotrim` into lexical order, autotrim tacked onto the end
of a list. Now it is in alphabetical order.

Clarify attach/detach description. Description was too specific to
command syntax. Overview clarifies reason for attaching or detaching
a device.

Clarify replace description, don't refer to subcommand arguments.

Clarify split command description, say what split actually does and
why you'd want to do it.

Clarify description of upgrade, and simplify the zpool.8 wording of

    [15 lines not shown]

ZFS on Linux/src 870fc32man/man8 zfs.8 zfsprops.8

Reorganize zfs(8) man page into sections

Most subcommands got their own manpages (e.g. create). Some related
commands grouped into a single manpage and symlinks created (e.g. set, 
get, and inherit). I did this when topics were either too short to 
warrant their own file or so interrelated that a user would want to
refer between commands in the same file.

Corrected .Sx internal references to .Xr cross refs; lots of .Sx 
references from when text was all in zfs.8 needed to be changed to 
.Xr zfs-$SUBCOMMAND 8 cross references.

Divided subcommand list in zfs(8) into sections of related 
functionality. This required writing new descriptions for some 
commands.

Preserved ".Os Linux", `.Os` macro parsing behavior differs between 
mandoc from the "BSD" mandoc package (available on Ubuntu) and man 
from Ubuntu's man-db package, which calls groff to format the manpages.

Groff handles the `.Os` macro differently and wrongly, defaulting 
it to "BSD" in `/usr/share/groff/*/tmac/mdoc/doc-common`, instead of
getting the default from `uname`.

A future set of changes will introduce build-time preprocessing of

    [14 lines not shown]