Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge with upstream #3

Merged
merged 135 commits into from
Jun 24, 2020
Merged

merge with upstream #3

merged 135 commits into from
Jun 24, 2020

Commits on Apr 6, 2020

  1. ZTS: Fix non-portable date format

    The delegate tests use `date(1)` to generate snapshot names, using
    the format '%F-%T-%N' to get nanosecond resolution (since multiple
    snapshots may be taken in the same second).  '%N' is not portable, and
    causes tests to fail on FreeBSD.
    
    Since the only purpose these timestamps serve is to create a unique
    name, simply use $RANDOM instead.
    
    Reviewed-by: John Kennedy <john.kennedy@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10170
    Ryan Moeller authored Apr 6, 2020
    Configuration menu
    Copy the full SHA
    4a21ec0 View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2020

  1. libzfs_pool: Remove unused check for ENOTBLK

    Commit 379ca9c removed the check on aux devices to be block devices also
    changing zfs_ioctl(hdl, ZFS_IOC_VDEV_ADD, ...) and
    zfs_ioctl(hdl, ZFS_IOC_POOL_CREATE, ...) to never set ENOTBLK. This
    change removes the dangling check for ENOTBLK that will never trigger.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reported-by: Richard Elling <Richard.Elling@RichardElling.com>
    Signed-off-by: Alex John <alex@stty.io>
    Closes openzfs#10173
    spaghetti- authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    2a15c6a View commit details
    Browse the repository at this point in the history
  2. Finish refactoring for ZFS_MODULE_PARAM_CALL

    Linux and FreeBSD have different parameters for tunable proc handler.
    This has prevented FreeBSD from implementing the ZFS_MODULE_PARAM_CALL
    macro.
    
    To complete the sharing of ZFS_MODULE_PARAM_CALL declarations, create
    per-platform definitions of the parameter list, ZFS_MODULE_PARAM_ARGS.
    
    With the declarations wired up we discovered an incorrect scope prefix
    for spa_slop_shift, so this is now fixed.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10179
    Ryan Moeller authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    7e3df9d View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2020

  1. Use vn_io_fault_uiomove on FreeBSD to avoid potential deadlock

    Added to prevent a possible deadlock, the following comments from
    FreeBSD explain the issue.  The comment describing vn_io_fault_uiomove:
    
    /*
     * Helper function to perform the requested uiomove operation using
     * the held pages for io->uio_iov[0].iov_base buffer instead of
     * copyin/copyout.  Access to the pages with uiomove_fromphys()
     * instead of iov_base prevents page faults that could occur due to
     * pmap_collect() invalidating the mapping created by
     * vm_fault_quick_hold_pages(), or pageout daemon, page laundry or
     * object cleanup revoking the write access from page mappings.
     *
     * Filesystems specified MNTK_NO_IOPF shall use vn_io_fault_uiomove()
     * instead of plain uiomove().
     */
    
    This used for vn_io_fault which has the following motivation:
    
    /*
     * The vn_io_fault() is a wrapper around vn_read() and vn_write() to
     * prevent the following deadlock:
     *
     * Assume that the thread A reads from the vnode vp1 into userspace
     * buffer buf1 backed by the pages of vnode vp2.  If a page in buf1 is
     * currently not resident, then system ends up with the call chain
     *   vn_read() -> VOP_READ(vp1) -> uiomove() -> [Page Fault] ->
     *     vm_fault(buf1) -> vnode_pager_getpages(vp2) -> VOP_GETPAGES(vp2)
     * which establishes lock order vp1->vn_lock, then vp2->vn_lock.
     * If, at the same time, thread B reads from vnode vp2 into buffer buf2
     * backed by the pages of vnode vp1, and some page in buf2 is not
     * resident, we get a reversed order vp2->vn_lock, then vp1->vn_lock.
     *
     * To prevent the lock order reversal and deadlock, vn_io_fault() does
     * not allow page faults to happen during VOP_READ() or VOP_WRITE().
     * Instead, it first tries to do the whole range i/o with pagefaults
     * disabled. If all pages in the i/o buffer are resident and mapped,
     * VOP will succeed (ignoring the genuine filesystem errors).
     * Otherwise, we get back EFAULT, and vn_io_fault() falls back to do
     * i/o in chunks, with all pages in the chunk prefaulted and held
     * using vm_fault_quick_hold_pages().
     *
     * Filesystems using this deadlock avoidance scheme should use the
     * array of the held pages from uio, saved in the curthread->td_ma,
     * instead of doing uiomove().  A helper function
     * vn_io_fault_uiomove() converts uiomove request into
     * uiomove_fromphys() over td_ma array.
     *
     * Since vnode locks do not cover the whole i/o anymore, rangelocks
     * make the current i/o request atomic with respect to other i/os and
     * truncations.
     */
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
    Closes openzfs#10177
    mattmacy authored Apr 8, 2020
    Configuration menu
    Copy the full SHA
    01c4f2b View commit details
    Browse the repository at this point in the history

Commits on Apr 9, 2020

  1. Linux 5.7 compat: blk_alloc_queue()

    Commit torvalds/linux@3d745ea5 simplified
    the blk_alloc_queue() interface by updating it to take the request
    queue as an argument.  Add a wrapper function which accepts the new
    arguments and internally uses the available interfaces.
    
    Other minor changes include increasing the Linux-Maximum to 5.6 now
    that 5.6 has been released.  It was not bumped to 5.7 because this
    release has not yet been finalized and is still subject to change.
    
    Added local 'struct zvol_state_os *zso' variable to zvol_alloc.
    
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: Tony Hutter <hutter2@llnl.gov>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10181 
    Closes openzfs#10187
    behlendorf authored Apr 9, 2020
    Configuration menu
    Copy the full SHA
    68dde63 View commit details
    Browse the repository at this point in the history
  2. Add separate field for indicating that spa is in middle of split

    By default it's not possible to open a device already owned by an
    active vdev. It's necessary to make an exception to this for vdev
    split. The FreeBSD platform code will make an exception if
    spa_is splitting is set to to true.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
    Closes openzfs#10178
    mattmacy authored Apr 9, 2020
    Configuration menu
    Copy the full SHA
    8b27e08 View commit details
    Browse the repository at this point in the history
  3. Don't ignore zfs_arc_max below allmem/32

    Set arc_c_min before arc_c_max so that when zfs_arc_min is set lower
    than the default allmem/32 zfs_arc_max can also be set lower.
    
    Add warning messages when tunables are being ignored.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10157
    Closes openzfs#10158
    Ryan Moeller authored Apr 9, 2020
    Configuration menu
    Copy the full SHA
    36a6e23 View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2020

  1. Persistent L2ARC

    This commit makes the L2ARC persistent across reboots. We implement
    a light-weight persistent L2ARC metadata structure that allows L2ARC
    contents to be recovered after a reboot. This significantly eases the
    impact a reboot has on read performance on systems with large caches.
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: George Wilson <gwilson@delphix.com>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Co-authored-by: Saso Kiselkov <skiselkov@gmail.com>
    Co-authored-by: Jorgen Lundman <lundman@lundman.net>
    Co-authored-by: George Amanakis <gamanakis@gmail.com>
    Ported-by: Yuxuan Shui <yshuiv7@gmail.com>
    Signed-off-by: George Amanakis <gamanakis@gmail.com>
    Closes openzfs#925 
    Closes openzfs#1823 
    Closes openzfs#2672 
    Closes openzfs#3744 
    Closes openzfs#9582
    gamanakis authored Apr 10, 2020
    Configuration menu
    Copy the full SHA
    77f6826 View commit details
    Browse the repository at this point in the history
  2. Add zstream redup command to convert deduplicated send streams

    Deduplicated send and receive is deprecated.  To ease migration to the
    new dedup-send-less world, the commit adds a `zstream redup` utility to
    convert deduplicated send streams to normal streams, so that they can
    continue to be received indefinitely.
    
    The new `zstream` command also replaces the functionality of
    `zstreamdump`, by way of the `zstream dump` subcommand.  The
    `zstreamdump` command is replaced by a shell script which invokes
    `zstream dump`.
    
    The way that `zstream redup` works under the hood is that as we read the
    send stream, we build up a hash table which maps from `<GUID, object,
    offset> -> <file_offset>`.
    
    Whenever we see a WRITE record, we add a new entry to the hash table,
    which indicates where in the stream file to find the WRITE record for
    this block. (The key is `drr_toguid, drr_object, drr_offset`.)
    
    For entries other than WRITE_BYREF, we pass them through unchanged
    (except for the running checksum, which is recalculated).
    
    For WRITE_BYREF records, we change them to WRITE records.  We find the
    referenced WRITE record by looking in the hash table (for the record
    with key `drr_refguid, drr_refobject, drr_refoffset`), and then reading
    the record header and payload from the specified offset in the stream
    file.  This is why the stream can not be a pipe.  The found WRITE record
    replaces the WRITE_BYREF record, with its `drr_toguid`, `drr_object`,
    and `drr_offset` fields changed to be the same as the WRITE_BYREF's
    (i.e. we are writing the same logical block, but with the data supplied
    by the previous WRITE record).
    
    This algorithm requires memory proportional to the number of WRITE
    records (same as `zfs send -D`), but the size per WRITE record is
    relatively low (40 bytes, vs. 72 for `zfs send -D`).  A 1TB send stream
    with 8KB blocks (`recordsize=8k`) would use around 5GB of RAM to
    "redup".
    
    Reviewed-by: Jorgen Lundman <lundman@lundman.net>
    Reviewed-by: Paul Dagnelie <pcd@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10124 
    Closes openzfs#10156
    ahrens authored Apr 10, 2020
    Configuration menu
    Copy the full SHA
    c618f87 View commit details
    Browse the repository at this point in the history

Commits on Apr 11, 2020

  1. Minor zstream redup command fixes

    * Fix uninitialized variable in `zstream redup` command.  The
      'rdt.ddt_count' variable is uninitialized because it was
      allocated from the stack and not globally.  Initialize it.
      This was reported by gcc when compiling with debugging enabled.
    
        zstream_redup.c:157:16: error: 'rdt.ddt_count' may be used
        uninitialized in this function [-Werror=maybe-uninitialized]
    
    * Remove the cmd/zstreamdump/.gitignore file.  It's no longer
      needed now that the zstreamdump command is a script.
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10192
    behlendorf authored Apr 11, 2020
    Configuration menu
    Copy the full SHA
    8080848 View commit details
    Browse the repository at this point in the history
  2. zvol_write() can use dmu_tx_hold_write_by_dnode()

    We can improve the performance of writes to zvols by using
    dmu_tx_hold_write_by_dnode() instead of dmu_tx_hold_write().  This
    reduces lock contention on the first block of the dnode object, and also
    reduces the amount of CPU needed.  The benefit will be highest with
    multi-threaded async writes (i.e. writes that don't call zil_commit()).
    
    Reviewed-by: Jorgen Lundman <lundman@lundman.net>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10184
    ahrens authored Apr 11, 2020
    Configuration menu
    Copy the full SHA
    20f2878 View commit details
    Browse the repository at this point in the history

Commits on Apr 13, 2020

  1. ZTS: Fix and change testcase cache_010_neg

    Commit 379ca9c removed the requirement on aux devices to be block
    devices only but the test case cache_010_neg was not updated, making it
    fail consistently.
    
    This change changes the test to check that cache devices _can_ be
    anything that presents a block interface. The testcase is renamed to
    cache_010_pos and the exceptions for known failure removed from the test
    runner.
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reported-by: Richard Elling <Richard.Elling@RichardElling.com>
    Signed-off-by: Alex John <alex@stty.io>
    Closes openzfs#10172
    spaghetti- authored Apr 13, 2020
    Configuration menu
    Copy the full SHA
    c602b35 View commit details
    Browse the repository at this point in the history
  2. Disable user space reference tracking

    The memory and cpu cost of reference count tracking with the current
    implementation is significant.  For this reason it has always been
    disabled by default for the kmods.  Apply this same default to user
    space so ztest doesn't always incur this performance penalty.
    
    Our intention is to re-enable this by default for ztest once the code
    has been optimized.  Since we expect to at some point provide a FUSE
    implementation we wouldn't want this enabled by default for libzpool.
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10189
    behlendorf authored Apr 13, 2020
    Configuration menu
    Copy the full SHA
    791e480 View commit details
    Browse the repository at this point in the history
  3. Fix allocation errors, detected using ASAN

    The test for VDEV_TYPE_INDIRECT is done after a memory allocation, and
    could return from function without freeing it.  Since we don't need that
    allocation yet, just postpone it.
    
    Add a missing free() when buffer is no longer needed.
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: João Carlos Mendes Luís <jonny@jonny.eng.br>
    Closes openzfs#10193
    dioni21 authored Apr 13, 2020
    Configuration menu
    Copy the full SHA
    75c6201 View commit details
    Browse the repository at this point in the history

Commits on Apr 14, 2020

  1. Add FreeBSD support to OpenZFS

    Add the FreeBSD platform code to the OpenZFS repository.  As of this
    commit the source can be compiled and tested on FreeBSD 11 and 12.
    Subsequent commits are now required to compile on FreeBSD and Linux.
    Additionally, they must pass the ZFS Test Suite on FreeBSD which is
    being run by the CI.  As of this commit 1230 tests pass on FreeBSD
    and there are no unexpected failures.
    
    Reviewed-by: Sean Eric Fagan <sef@ixsystems.com>
    Reviewed-by: Jorgen Lundman <lundman@lundman.net>
    Reviewed-by: Richard Laager <rlaager@wiktel.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Co-authored-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#898 
    Closes openzfs#8987
    mattmacy authored Apr 14, 2020
    Configuration menu
    Copy the full SHA
    9f0a21e View commit details
    Browse the repository at this point in the history
  2. sys/mnttab.h: include sys/stat.h for stat64

    Musl libc defined `stat64` as a macro, which causes the build to fail
    upon compiling os/linux/getmntany.c due to conflicts between the forward
    declaration and the implementation.
    
    This commit fixes that by including <sys/stat.h> in "sys/mnttab.h"
    directly.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Hiếu Lê <leorize+oss@disroot.org>
    Closes openzfs#10195
    alaviss authored Apr 14, 2020
    Configuration menu
    Copy the full SHA
    6b1139e View commit details
    Browse the repository at this point in the history
  3. Fix SC2086 note in zpool.d/smart

    ./cmd/zpool/zpool.d/smart:78:32:
    note: Double quote to prevent globbing and word splitting. [SC2086]
    
    Reported by latest shellcheck on FreeBSD.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10194
    Ryan Moeller authored Apr 14, 2020
    Configuration menu
    Copy the full SHA
    813c856 View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2020

  1. Don't delete freebsd.run in distclean

    Add a comment so the file is not empty.
    
    The comment can be removed when FreeBSD-specific tests are added.
    
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: Sean Eric Fagan <sef@ixsystems.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10206
    Ryan Moeller authored Apr 15, 2020
    Configuration menu
    Copy the full SHA
    af99094 View commit details
    Browse the repository at this point in the history
  2. Update FreeBSD tunables

    Remove some obsolete legacy compat, rename some misnamed, and add some
    missing tunables for FreeBSD.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10203
    Ryan Moeller authored Apr 15, 2020
    Configuration menu
    Copy the full SHA
    a7929f3 View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2020

  1. Persistent L2ARC minor fixes

    Minor fixes on persistent L2ARC improving code readability and fixing 
    a typo in zdb.c when byte-swapping a log block. It also improves the 
    pesist_l2arc_007_pos.ksh test by giving it more time to retrieve log 
    blocks on the cache device.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Adam D. Moss <c@yotes.com>
    Signed-off-by: George Amanakis <gamanakis@gmail.com>
    Closes openzfs#10210
    gamanakis authored Apr 17, 2020
    Configuration menu
    Copy the full SHA
    9249f12 View commit details
    Browse the repository at this point in the history
  2. Use new FreeBSD API to largely eliminate object locking

    Propagate changes in HEAD that mostly eliminate object locking.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
    Closes openzfs#10205
    mattmacy authored Apr 17, 2020
    Configuration menu
    Copy the full SHA
    c614fd6 View commit details
    Browse the repository at this point in the history

Commits on Apr 20, 2020

  1. Fix zfs send progress reporting

    The progress of a send is supposed to be reported by `zfs send -v`, but
    it is not.  This works by creating a new user thread (with
    pthread_create()) which does ZFS_IOC_SEND_PROGRESS ioctls to check how
    much progress has been made.  This IOCTL finds the specified send (since
    there may be multiple concurrent sends in the system).  The IOCTL also
    checks that the specified send was started by the current process.
    
    On Linux, different threads of the same process are represented as
    different `struct task_struct`s (and, confusingly, have different
    PID's).  To check if if two threads are in the same process, we need to
    check if they have the same `struct task_struct:group_leader`.
    
    We used to to this correctly, but it was inadvertently changed by
    30af21b (Redacted Send) to simply check if the current
    `struct task_struct` is the one that started the send.
    
    This commit changes the code back to checking if the send was started by
    a `struct task_struct` with the same `group_leader` as the calling
    thread.
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: Chris Wedgwood <cw@f00f.org>
    Reviewed-by: Paul Dagnelie <pcd@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10215 
    Closes openzfs#10216
    ahrens authored Apr 20, 2020
    Configuration menu
    Copy the full SHA
    1f043c8 View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2020

  1. Don't attempt trimming "hole" vdevs

    On zpools containing hole vdevs (e.g. removed log devices), the `zpool
    trim` (and presumably `zpool initialize`) commands will attempt calling
    their respective functions on "hole", which fails, as this is not a real
    vdev.
    
    Avoid this by removing HOLE vdevs in zpool_collect_leaves.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Signed-off-by: Niklas Haas <git@haasn.xyz>
    Closes openzfs#10227
    haasn authored Apr 21, 2020
    Configuration menu
    Copy the full SHA
    a84c92f View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2020

  1. Use a struct to organize metaslab-group-allocator fields

    Each metaslab group (of which there is one per top-level vdev) has
    several (4, by default) "metaslab group allocators".  Each "allocator"
    has its own metaslab that it prefers to allocate from (the "primary"
    allocator), and each can perform allocations concurrently with the other
    allocators.  In addition to the primary metaslab, there are several
    other fields that need to be tracked separately for each allocator.
    These are currently stored as several arrays in the metaslab_group_t,
    each array indexed by allocator number.
    
    This change organizes all the metaslab-group-allocator-specific fields
    into a new struct, metaslab_group_allocator_t.  The metaslab_group_t now
    needs only one array indexed by the allocator number - which contains
    the metaslab_group_allocator_t's.
    
    Reviewed-by: Paul Dagnelie <pcd@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10213
    ahrens authored Apr 22, 2020
    Configuration menu
    Copy the full SHA
    32d805c View commit details
    Browse the repository at this point in the history
  2. Fix more leaks detected by ASAN

    This commit fixes a bunch of missing free() calls in a10d50f
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: João Carlos Mendes Luís <jonny@jonny.eng.br>
    Closes openzfs#10219
    dioni21 authored Apr 22, 2020
    Configuration menu
    Copy the full SHA
    70e5ad3 View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2020

  1. Remove deduplicated send/receive code

    Deduplicated send streams (i.e. `zfs send -D` and `zfs receive` of such
    streams) are deprecated.  Deduplicated send streams can be received by
    first converting them to non-deduplicated with the `zstream redup`
    command.
    
    This commit removes the code for sending and receiving deduplicated send
    streams.  `zfs send -D` will now print a warning, ignore the `-D` flag,
    and generate a regular (non-deduplicated) send stream.  `zfs receive` of
    a deduplicated send stream will print an error message and fail.
    
    The resulting code simplification (especially in the kernel's support
    for receiving dedup streams) should help enable future performance
    enhancements.
    
    Several new tests are added which leverage `zstream redup`.
    
    Reviewed-by: Paul Dagnelie <pcd@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Issue openzfs#7887
    Issue openzfs#10117
    Issue openzfs#10156
    Closes openzfs#10212
    ahrens authored Apr 23, 2020
    Configuration menu
    Copy the full SHA
    196bee4 View commit details
    Browse the repository at this point in the history
  2. change libspl list member names to match kernel

    This aids in debugging, so that we can use the same infrastructure to
    walk zfs's list_t in the kernel module and in the userland libraries
    (e.g. when debugging ztest).
    
    Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10236
    ahrens authored Apr 23, 2020
    Configuration menu
    Copy the full SHA
    5d4ed96 View commit details
    Browse the repository at this point in the history
  3. Fix unitialized variable in zstream redup command

    Fix uninitialized variable in `zstream redup` command.  The compiler
    may determine the 'stream_offset' variable can be uninitialized
    because not all rdt_lookup() exit paths set it.  This should never
    happen in practice as documented by the assert, but initialize it
    regardless to resolve the warning.
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10241
    Closes openzfs#10244
    behlendorf authored Apr 23, 2020
    Configuration menu
    Copy the full SHA
    6de3e59 View commit details
    Browse the repository at this point in the history

Commits on Apr 25, 2020

  1. Fix missing ivset guid with resumed raw base recv

    This patch corrects a bug introduced in 61152d1. When
    resuming a raw base receive, the dmu_recv code always sets
    drc->drc_fromsnapobj to the object ID of the previous
    snapshot. For incrementals, this is correct, but for base
    sends, this should be left at 0. The presence of this ID
    eventually allows a check to run which determines whether
    or not the incoming stream and the previous snapshot have
    matching IVset guids. This check fails becuase it is not
    meant to run when there is no previous snapshot. When it
    does fail, the user receives an error stating that the
    incoming stream has the problem outlined in errata 4.
    
    This patch corrects this issue by simply ensuring
    drc->drc_fromsnapobj is left as 0 for base receives.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Signed-off-by: Tom Caputi <tcaputi@datto.com>
    Closes openzfs#10234 
    Closes openzfs#10239
    Tom Caputi authored Apr 25, 2020
    Configuration menu
    Copy the full SHA
    aa64632 View commit details
    Browse the repository at this point in the history
  2. zfs_create: round up volume size to multiple of bs

    Round up the volume size requested in `zfs create -V size` to the next
    higher multiple of the volblocksize. Updates the man page and adds a
    test to verify the new behavior.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reported-by: puffi <puffi@users.noreply.github.com>
    Signed-off-by: Alex John <alex@stty.io>
    Closes openzfs#8541 
    Closes openzfs#10196
    spaghetti- authored Apr 25, 2020
    Configuration menu
    Copy the full SHA
    47c9299 View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2020

  1. Fix zlib leak on FreeBSD

    zlib_inflateEnd was accidentally a wrapper for inflateInit instead of
    inflateEnd, and hilarity ensues.
    
    Fix the typo so we free memory instead of allocating more.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10225
    Closes openzfs#10252
    Ryan Moeller authored Apr 28, 2020
    Configuration menu
    Copy the full SHA
    a808518 View commit details
    Browse the repository at this point in the history
  2. Add missing zfs_refcount_destroy() in key_mapping_rele()

    Otherwise when running with reference_tracking_enable=TRUE mounting
    and unmounting an encrypted dataset panics with:
    
    Call Trace:
     dump_stack+0x66/0x90
     slab_err+0xcd/0xf2
     ? __kmalloc+0x174/0x260
     ? __kmem_cache_shutdown+0x158/0x240
     __kmem_cache_shutdown.cold+0x1d/0x115
     shutdown_cache+0x11/0x140
     kmem_cache_destroy+0x210/0x230
     spl_kmem_cache_destroy+0x122/0x3e0 [spl]
     zfs_refcount_fini+0x11/0x20 [zfs]
     spa_fini+0x4b/0x120 [zfs]
     zfs_kmod_fini+0x6b/0xa0 [zfs]
     _fini+0xa/0x68c [zfs]
     __x64_sys_delete_module+0x19c/0x2b0
     do_syscall_64+0x5b/0x1a0
     entry_SYSCALL_64_after_hwframe+0x44/0xa9
    
    Reviewed-By: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-By: Tom Caputi <tcaputi@datto.com>
    Signed-off-by: George Amanakis <gamanakis@gmail.com>
    Closes openzfs#10246
    gamanakis authored Apr 28, 2020
    Configuration menu
    Copy the full SHA
    fa25460 View commit details
    Browse the repository at this point in the history
  3. Add more sanity testing for zdb input args

    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: John Kennedy <john.kennedy@delphix.com>
    Signed-off-by: sara hartse <sara.hartse@delphix.com>
    Closes openzfs#10243
    Sara Hartse authored Apr 28, 2020
    Configuration menu
    Copy the full SHA
    89a6610 View commit details
    Browse the repository at this point in the history
  4. Support custom URI schemes for the keylocation property

    Every platform has their own preferred methods for implementing URI 
    schemes beyond the currently supported file scheme (e.g. 'https' on 
    FreeBSD would likely use libfetch, while Linux distros and illumos
    would probably use libcurl, etc). It would be helpful if libzfs can 
    be extended to support additional schemes in a simple manner.
    
    A table of (scheme, handler_function) pairs is added to libzfs_crypto.c, 
    and the existing functions in libzfs_crypto.c so that when the key 
    format is ZFS_KEYFORMAT_URI, the scheme from the URI string is 
    extracted, and a matching handler it located in the aforementioned 
    table (returning an error if no matching handler is found). The handler 
    function is then invoked to retrieve the key material (in the format 
    specified by the keyformat property) and the key is loaded or the 
    handler can return an error to abort the key loading process.
    
    Reviewed by: Sean Eric Fagan <sef@ixsystems.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jason King <jason.king@joyent.com>
    Closes openzfs#10218
    jasonbking authored Apr 28, 2020
    Configuration menu
    Copy the full SHA
    c14ca14 View commit details
    Browse the repository at this point in the history

Commits on Apr 30, 2020

  1. Add longjmp support for Thumb-2

    When a Thumb-2 kernel is being used, then longjmp must be implemented
    using the Thumb-2 instruction set in module/lua/setjmp/setjmp_arm.S.
    
    Original-patch-by: @jsrlabs
    Reviewed-by: @awehrfritz
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#7408 
    Closes openzfs#9957 
    Closes openzfs#9967
    behlendorf authored Apr 30, 2020
    Configuration menu
    Copy the full SHA
    ab16c87 View commit details
    Browse the repository at this point in the history
  2. Fix regression caused by c14ca14

    The 'zfs load-key' command was broken for 'keyformat=passphrase'.
    Use the correct output vars when stdin is an interactive terminal.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: adam moss <c@yotes.com>
    Closes openzfs#10264 
    Closes openzfs#10265
    adamdmoss authored Apr 30, 2020
    Configuration menu
    Copy the full SHA
    d7d4678 View commit details
    Browse the repository at this point in the history
  3. OpenZFS 742 - Resurrect the ZFS "aclmode" property OpenZFS 664 - Umas…

    …k masking "deny" ACL entries OpenZFS 279 - Bug in the new ACL (post-PSARC/2010/029) semantics
    
    Porting notes:
    * Updated zfs_acl_chmod to take 'boolean_t isdir' as first parameter
      rather than 'zfsvfs_t *zfsvfs'
    * zfs man pages changes mixed between zfs and new zfsprops man pages
    
    Reviewed by: Aram Hvrneanu <aram@nexenta.com>
    Reviewed by: Gordon Ross <gwr@nexenta.com>
    Reviewed by: Robert Gordon <rbg@openrbg.com>
    Reviewed by: Mark.Maybee@oracle.com
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Approved by: Garrett D'Amore <garrett@nexenta.com>
    Ported-by: Paul B. Henson <henson@acm.org>
    
    OpenZFS-issue: https://www.illumos.org/issues/742
    OpenZFS-issue: https://www.illumos.org/issues/664
    OpenZFS-issue: https://www.illumos.org/issues/279
    OpenZFS-commit: openzfs/openzfs@a3c49ce110
    Closes openzfs#10266
    pbhenson authored and behlendorf committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    a1af567 View commit details
    Browse the repository at this point in the history
  4. OpenZFS 3254 - add support in zfs for aclmode=restricted

    Authored-by: Paul B. Henson <henson@acm.org>
    Reviewed by: Albert Lee <trisk@nexenta.com>
    Reviewed by: Gordon Ross <gwr@nexenta.com>
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Approved by: Richard Lowe <richlowe@richlowe.net>
    Ported-by: Paul B. Henson <henson@acm.org>
    
    OpenZFS-issue: https://www.illumos.org/issues/3254
    OpenZFS-commit: openzfs/openzfs@71dbfc287c
    Closes openzfs#10266
    pbhenson authored and behlendorf committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    7bf3e1f View commit details
    Browse the repository at this point in the history
  5. OpenZFS 6764 - zfs issues with inheritance flags during chmod(2)

    with aclmode=passthrough
    
    Authored by: Albert Lee <trisk@nexenta.com>
    Reviewed by: Gordon Ross <gwr@nexenta.com>
    Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Approved by: Richard Lowe <richlowe@richlowe.net>
    Ported-by: Paul B. Henson <henson@acm.org>
    
    OpenZFS-issue: https://www.illumos.org/issues/6764
    OpenZFS-commit: openzfs/openzfs@de0f1ddb59
    Closes openzfs#10266
    pbhenson authored and behlendorf committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    5a2f527 View commit details
    Browse the repository at this point in the history
  6. OpenZFS 8984 - fix for 6764 breaks ACL inheritance

    Authored by: Dominik Hassler <hadfl@omniosce.org>
    Reviewed by: Sam Zaydel <szaydel@racktopsystems.com>
    Reviewed by: Paul B. Henson <henson@acm.org>
    Reviewed by: Prakash Surya <prakash.surya@delphix.com>
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Approved by: Matthew Ahrens <mahrens@delphix.com>
    Ported-by: Paul B. Henson <henson@acm.org>
    
    OpenZFS-issue: https://www.illumos.org/issues/8984
    OpenZFS-commit: openzfs/openzfs@e9bacc6d1a
    Closes openzfs#10266
    pbhenson authored and behlendorf committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    99495ba View commit details
    Browse the repository at this point in the history
  7. OpenZFS 6762 - POSIX write should imply DELETE_CHILD on directories

    - and some additional considerations
    
    Authored by: Kevin Crowe <kevin.crowe@nexenta.com>
    Reviewed by: Gordon Ross <gwr@nexenta.com>
    Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Approved by: Richard Lowe <richlowe@richlowe.net>
    Ported-by: Paul B. Henson <henson@acm.org>
    
    OpenZFS-issue: https://www.illumos.org/issues/6762
    OpenZFS-commit: openzfs/openzfs@1eb4e906ec
    Closes openzfs#10266
    pbhenson authored and behlendorf committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    235a856 View commit details
    Browse the repository at this point in the history
  8. OpenZFS 6765 - zfs_zaccess_delete() comments do not accurately

    reflect delete permissions for ACLs
    
    Authored by: Kevin Crowe <kevin.crowe@nexenta.com>
    Reviewed by: Gordon Ross <gwr@nexenta.com>
    Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Approved by: Richard Lowe <richlowe@richlowe.net>
    Ported-by: Paul B. Henson <henson@acm.org>
    
    Porting Notes:
    * Only comments are updated
    
    OpenZFS-issue: https://www.illumos.org/issues/6765
    OpenZFS-commit: openzfs/openzfs@da412744bc
    Closes openzfs#10266
    pbhenson authored and behlendorf committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    0aeb0be View commit details
    Browse the repository at this point in the history

Commits on May 1, 2020

  1. zdb: Fix ignored zfs_arc_max tuning

    Running zdb -l $disk shows a warning that zfs_arc_max is being ignored.
    zdb sets zfs_arc_max below zfs_arc_min, which causes the value to be
    ignored by arc_tuning_update().
    
    Set zfs_arc_min to the bare minimum in zdb, which is below zfs_arc_max.
    
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Allan Jude <allanjude@freebsd.org>
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10269
    Ryan Moeller authored May 1, 2020
    Configuration menu
    Copy the full SHA
    154e48e View commit details
    Browse the repository at this point in the history
  2. ZTS: Count CKSUM for all vdevs in verify_pool

    The verify_pool function should detect checksum errors on any vdev, but
    it was only checking at the root of the pool.
    
    Accumulate the errors for all vdevs to obtain the correct count.
    
    Reviewed-by: John Kennedy <john.kennedy@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10271
    Ryan Moeller authored May 1, 2020
    Configuration menu
    Copy the full SHA
    6ed4391 View commit details
    Browse the repository at this point in the history

Commits on May 4, 2020

  1. Update FreeBSD SPL atomics

    Sync up with the following changes from FreeBSD:
    
    ZFS: add emulation of atomic_swap_64 and atomic_load_64
    
    Some 32-bit platforms do not provide 64-bit atomic operations that ZFS
    requires, either in userland or at all.  We emulate those operations
    for those platforms using a mutex.  That is not entirely correct and
    it's very efficient.  Besides, the loads are plain loads, so torn
    values are possible.
    
    Nevertheless, the emulation seems to work for some definition of work.
    
    This change adds atomic_swap_64, which is already used in ZFS code,
    and atomic_load_64 that can be used to prevent torn reads.
    
    Authored by: avg <avg@FreeBSD.org>
    FreeBSD-commit: freebsd/freebsd-src@3458e5d
    
    cleanup of illumos compatibility atomics
    
    atomic_cas_32 is implemented using atomic_fcmpset_32 on all platforms.
    Ditto for atomic_cas_64 and atomic_fcmpset_64 on platforms that have
    it.  The only exception is sparc64 that provides MD atomic_cas_32 and
    atomic_cas_64.
    This is slightly inefficient as fcmpset reports whether the operation
    updated the target and that information is not needed for cas.
    Nevertheless, there is less code to maintain and to add for new
    platforms.  Also, the operations are done inline now as opposed to
    function calls before.
    
    atomic_add_64_nv is implemented using atomic_fetchadd_64 on platforms
    that provide it.
    
    casptr, cas32, atomic_or_8, atomic_or_8_nv are completely removed as
    they have no users.
    
    atomic_mtx that is used to emulate 64-bit atomics on platforms that
    lack them is defined only on those platforms.
    
    As a result, platform specific opensolaris_atomic.S files have lost
    most of their code.  The only exception is i386 where the
    compat+contrib code provides 64-bit atomics for userland use.  That
    code assumes availability of cmpxchg8b instruction.  FreeBSD does not
    have that assumption for i386 userland and does not provide 64-bit
    atomics.  Hopefully, this can and will be fixed.
    
    Authored by: avg <avg@FreeBSD.org>
    FreeBSD-commit: freebsd/freebsd-src@e9642c2
    
    emulate illumos membar_producer with atomic_thread_fence_rel
    
    membar_producer is supposed to be a store-store barrier.
    Also, in the code that FreeBSD has ported from illumos membar_producer
    is used only with regular stores to regular memory (with respect to
    caching).
    
    We do not have an MI primitive for the store-store barrier, so
    atomic_thread_fence_rel is the closest we have as it provides
    (load | store) -> store barrier.
    
    Previously, membar_producer was an empty function call on all 32-bit
    arm-s, 32-bit powerpc, riscv and all mips variants.  I think that it
    was inadequate.
    On other platforms, such as amd64, arm64, i386, powerpc64, sparc64,
    membar_producer was implemented using stronger primitives than required
    for a store-store barrier with respect to regular memory access.
    For example, it used sfence on amd64 and lock-ed nop in i386 (despite
    TSO).
    On powerpc64 we now use recommended lwsync instead of eieio.
    On sparc64 FreeBSD uses TSO mode.
    On arm64/aarch64 we now use dmb sy instead of dmb ish.  Not sure if
    this is an improvement, actually.
    
    After this change we can drop opensolaris_atomic.S for aarch64, amd64,
    powerpc64 and sparc64 as all required atomic operations have either
    direct or light-weight mapping to FreeBSD native atomic operations.
    
    Discussed with: kib
    Authored by: avg <avg@FreeBSD.org>
    FreeBSD-commit: freebsd/freebsd-src@50cdda6
    
    fix up r353340, don't assume that fcmpset has strong semantics
    
    fcmpset can have two kinds of semantics, weak and strong.
    For practical purposes, strong semantics means that if fcmpset fails
    then the reported current value is always different from the expected
    value.  Weak semantics means that the reported current value may be the
    same as the expected value even though fcmpset failed.  That's a so
    called "sporadic" failure.
    
    I originally implemented atomic_cas expecting strong semantics, but
    many platforms actually have weak one.
    
    Reported by:    pkubaj (not confirmed if same issue)
    Discussed with: kib, mjg
    Authored by: avg <avg@FreeBSD.org>
    FreeBSD-commit: freebsd/freebsd-src@238787c
    
    [PowerPC] [MIPS] Implement 32-bit kernel emulation of atomic64 operations
    
    This is a lock-based emulation of 64-bit atomics for kernel use, split off
    from an earlier patch by jhibbits.
    
    This is needed to unblock future improvements that reduce the need for
    locking on 64-bit platforms by using atomic updates.
    
    The implementation allows for future integration with userland atomic64,
    but as that implies going through sysarch for every use, the current
    status quo of userland doing its own locking may be for the best.
    
    Submitted by:   jhibbits (original patch), kevans (mips bits)
    Reviewed by:    jhibbits, jeff, kevans
    Authored by: bdragon <bdragon@FreeBSD.org>
    Differential Revision:  https://reviews.freebsd.org/D22976
    FreeBSD-commit: freebsd/freebsd-src@db39dab
    
    Remove sparc64 kernel support
    
    Remove all sparc64 specific files
    Remove all sparc64 ifdefs
    Removee indireeect sparc64 ifdefs
    
    Authored by: imp <imp@FreeBSD.org>
    FreeBSD-commit: freebsd/freebsd-src@48b9486
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Ported-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10250
    Ryan Moeller authored May 4, 2020
    Configuration menu
    Copy the full SHA
    639dfeb View commit details
    Browse the repository at this point in the history
  2. Avoid the GEOM topology lock recursion when autoexpanding a pool

    The steps to reproduce the problem:
    
            mdconfig -a -t swap -s 3g -u 0
            gpart create -s GPT md0
            gpart add -t freebsd-zfs -s 1g md0
            zpool create -o autoexpand=on foo md0p1
            gpart resize -i 1 -s 2g md0
    
    Authored by: pjd <pjd@FreeBSD.org>
    FreeBSD-commit: freebsd/freebsd-src@bccd2db
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Ported-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10270
    Ryan Moeller authored May 4, 2020
    Configuration menu
    Copy the full SHA
    6f3e1a4 View commit details
    Browse the repository at this point in the history
  3. config/kernel-inode-times: initialize timespec

    Usage of this variable uninitialized triggers -Werror,-Wuninitialized
    when compiled under clang for linux kernel 5.6, leading the build system
    to believe that the function is not declared.
    
    This commit initializes the variable to suppress the warning and fix the
    build for kernel 5.6 with clang.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Hiếu Lê <leorize+oss@disroot.org>
    Closes openzfs#10279
    Closes openzfs#10281
    alaviss authored May 4, 2020
    Configuration menu
    Copy the full SHA
    3e5d41d View commit details
    Browse the repository at this point in the history

Commits on May 5, 2020

  1. taskq: Don't leak system_delay_taskq on FreeBSD

    Adds a missing taskq_destroy() call.
    
    Reported by: Jorgen Lundman <lundman@lundman.net>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10292
    Ryan Moeller authored May 5, 2020
    Configuration menu
    Copy the full SHA
    ddc7a2d View commit details
    Browse the repository at this point in the history

Commits on May 6, 2020

  1. Enable splitting mirrors with indirect vdevs

    When a top-level vdev is removed from a pool it is converted to an
    indirect vdev. Until now splitting such mirrored pools was not possible
    with zpool split. This patch enables handling of indirect vdevs and
    splitting of those pools with zpool split.
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: George Amanakis <gamanakis@gmail.com>
    Closes openzfs#10283
    gamanakis authored May 6, 2020
    Configuration menu
    Copy the full SHA
    1b66495 View commit details
    Browse the repository at this point in the history

Commits on May 7, 2020

  1. Fix column width calculation issue with certain terminal widths

    If the reported terminal width is 0 or less than 42, the signed variable
    width was set to a negative number that was then assigned to the
    unsigned column width becoming a huge number.
    
    Add comments and change logic to better explain what's happening.
    
    Reviewed-by: Tony Hutter <hutter2@llnl.gov>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Philip Pokorny <ppokorny@mindspring.com>
    Closes openzfs#10247
    ppokorny authored May 7, 2020
    Configuration menu
    Copy the full SHA
    a36bad1 View commit details
    Browse the repository at this point in the history
  2. Add support for boot environment data to be stored in the label

    Modern bootloaders leverage data stored in the root filesystem to 
    enable some of their powerful features. GRUB specifically has a grubenv 
    file which can store large amounts of configuration data that can be 
    read and written at boot time and during normal operation. This allows 
    sysadmins to configure useful features like automated failover after 
    failed boot attempts. Unfortunately, due to the Copy-on-Write nature 
    of ZFS, the standard behavior of these tools cannot handle writing to
    ZFS files safely at boot time. We need an alternative way to store 
    data that allows the bootloader to make changes to the data.
    
    This work is very similar to work that was done on Illumos to enable 
    similar functionality in the FreeBSD bootloader. This patch is different 
    in that the data being stored is a raw grubenv file; this file can store 
    arbitrary variables and values, and the scripting provided by grub is 
    powerful enough that special structures are not required to implement 
    advanced behavior.
    
    We repurpose the second padding area in each label to store the grubenv 
    file, protected by an embedded checksum. We add two ioctls to get and 
    set this data, and libzfs_core and libzfs functions to access them more 
    easily. There are no direct command line interfaces to these functions; 
    these will be added directly to the bootloader utilities.
    
    Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Paul Dagnelie <pcd@delphix.com>
    Closes openzfs#10009
    pcd1193182 authored May 7, 2020
    Configuration menu
    Copy the full SHA
    108a454 View commit details
    Browse the repository at this point in the history
  3. Improvements on persistent L2ARC

    Functional changes:
    
    We implement refcounts of log blocks and their aligned size on the
    cache device along with two corresponding arcstats. The refcounts are
    reflected in the header of the device and provide valuable information
    as to whether log blocks are accounted for correctly. These are
    dynamically adjusted as log blocks are committed/evicted. zdb also uses
    this information in the device header and compares it to the
    corresponding values as reported by dump_l2arc_log_blocks() which
    emulates l2arc_rebuild(). If the refcounts saved in the device header
    report higher values, zdb exits with an error. For this feature to work
    correctly there should be no active writes on the device. This is also
    employed in the tests of persistent L2ARC. We extend the structure of
    the cache device header by adding the two new variables mirroring the
    refcounts after the existing variables to preserve backward
    compatibility in terms of persistent L2ARC.
    
    1) a new arcstat "l2_log_blk_asize" and refcount "l2ad_lb_asize" which
       reflect the total aligned size of log blocks on the device. This is
       also reflected in the header of the cache device as "dh_lb_asize".
    2) a new arcstat "l2arc_log_blk_count" and refcount "l2ad_lb_count"
       which reflect the total number of L2ARC log blocks present on cache
       devices.  It is also reflected in the header of the cache device as
       "dh_lb_count".
    
    In l2arc_rebuild_vdev() if the amount of committed log entries in a log
    block is 0 and the device header is valid we update the device header.
    This will facilitate trimming of the whole device in this case when
    TRIM for L2ARC is implemented.
    
    Improve loop protection in l2arc_rebuild() by using the starting offset
    of the payload of each log block instead of the starting offset of the
    log block.
    
    If the zio in l2arc_write_buffers() fails, restore the lbps array in the
    header of the device to its previous state in l2arc_write_done().
    
    If l2arc_rebuild() ends the rebuild process without restoring any L2ARC
    log blocks in ARC and without any other error, this means that the lbps
    array in the header is pointing to non-existent or invalid log blocks.
    Reset the device header in this case.
    
    In l2arc_rebuild() change the zfs_dbgmsg messages to
    spa_history_log_internal() making them user visible with zpool history
    command.
    
    Non-functional changes:
    
    Make the first test in persistent L2ARC use `zdb -lll` to increase
    coverage in `zdb.c`.
    
    Rename psize with asize when referring to log blocks, since
    L2ARC_SET_PSIZE stores the vdev aligned size for log blocks. Also
    rename dh_log_blk_entries to dh_log_entries to make it clear that
    it is a mirror of l2ad_log_entries. Added comments for both changes.
    
    Fix inaccurate comments for example in l2arc_log_blk_restore().
    
    Add asserts at the end in l2arc_evict() and l2arc_write_buffers().
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: George Amanakis <gamanakis@gmail.com>
    Closes openzfs#10228
    gamanakis authored May 7, 2020
    Configuration menu
    Copy the full SHA
    657fd33 View commit details
    Browse the repository at this point in the history
  4. Cleanup contrib/initramfs automake

    The initramfs hook scripts depend on Makefile.  This way, if the
    substitution code is changed, they should update.  This brings it in
    line with etc/init.d (which was modified to match the example in the
    automake docs).
    
    The initramfs hook script cleaning now matches etc/init.d.
    
    There was a mix of SUBDIRS recursion and custom install rules for files
    in subdirectories.  This was duplicated for the "hooks" and "scripts"
    subdirectories.  Now everything uses SUBDIRS.
    
    I fixed the substitution of DEFAULT_INITCONF_DIR for hooks/zfs.
    
    Reviewed-By: Andrey Prokopenko <job@terem.fr>
    Reviewed-By: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-By: Tom Caputi <tcaputi@datto.com>
    Signed-off-by: Richard Laager <rlaager@wiktel.com>
    Closes openzfs#10027
    rlaager authored and behlendorf committed May 7, 2020
    Configuration menu
    Copy the full SHA
    4cfd339 View commit details
    Browse the repository at this point in the history
  5. Rework README.initramfs.markdown

    This file is listed as being in Markdown format, but it didn't really
    use much Markdown.  I have added a fair amount of formatting.
    
    I have reordered and reworded things to improve the flow of the text.
    
    Reviewed-By: Andrey Prokopenko <job@terem.fr>
    Reviewed-By: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-By: Tom Caputi <tcaputi@datto.com>
    Signed-off-by: Richard Laager <rlaager@wiktel.com>
    Closes openzfs#10027
    rlaager authored and behlendorf committed May 7, 2020
    Configuration menu
    Copy the full SHA
    746d22e View commit details
    Browse the repository at this point in the history
  6. Unlock encrypted root partition over SSH

    This commit add a new feature for Debian-based distributions to unlock
    encrypted root partition over SSH.  This feature is very handy on
    headless NAS or VPS cloud servers.  To use this feature, you will need
    to install the dropbear-initramfs package.
    
    Reviewed-By: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-By: Tom Caputi <tcaputi@datto.com>
    Signed-off-by: Andrey Prokopenko <job@terem.fr>
    Signed-off-by: Richard Laager <rlaager@wiktel.com>
    Closes openzfs#10027
    terem42 authored and behlendorf committed May 7, 2020
    Configuration menu
    Copy the full SHA
    1cc635a View commit details
    Browse the repository at this point in the history

Commits on May 8, 2020

  1. ZTS: refreserv_005_pos.ksh

    When recursively destroying the dataset it's possible for the
    dataset volume to be open by an unrelated process, like blkid.
    Use the destroy_dataset() which will retry when this occurs.
    
    Reviewed-by: John Kennedy <john.kennedy@delphix.com>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10305
    behlendorf authored May 8, 2020
    Configuration menu
    Copy the full SHA
    d775c86 View commit details
    Browse the repository at this point in the history

Commits on May 9, 2020

  1. Fixed LDADD library links in Makefiles for cross compilation builds

    When building on native dev system, there are no issues but when
    cross-compiling for target system, some linker errors are observed.
    The only way to avoid these errors is by adjusting the Makefile.am
    of those various components to add the library dependencies.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Signed-off-by: Petros Koutoupis <petros@petroskoutoupis.com>
    Closes openzfs#10304
    pkoutoupis authored May 9, 2020
    Configuration menu
    Copy the full SHA
    bd95f00 View commit details
    Browse the repository at this point in the history

Commits on May 10, 2020

  1. Combine OS-independent ABD Code into Common Source File

    Reorganizing ABD code base so OS-independent ABD code has been placed
    into a common abd.c file. OS-dependent ABD code has been left in each
    OS's ABD source files, and these source files have been renamed to
    abd_os.
    
    The OS-independent ABD code is now under:
    module/zfs/abd.c
    With the OS-dependent code in:
    module/os/linux/zfs/abd_os.c
    module/os/freebsd/zfs/abd_os.c
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
    Closes openzfs#10293
    bwatkinson authored May 10, 2020
    Configuration menu
    Copy the full SHA
    fc551d7 View commit details
    Browse the repository at this point in the history
  2. Change zfsunlock for better busybox compatibility

    It turns out that there are two versions of Busybox, at least on Ubuntu
    18.04.  If you have the busybox-static package installed, you get a
    busybox that supports `ps a` and `head`.  If you only have
    busybox-initramfs, you don't.  Either way, you have `awk`.
    
    This change should also make this compatible with GNU ps, if you somehow
    end up with that in the initramfs environment.
    
    Reviewed-by: Tom Caputi <tcaputi@datto.com>
    Reviewed-by: Andrey Prokopenko <job@terem.fr>
    Signed-off-by: Richard Laager <rlaager@wiktel.com>
    Closes openzfs#10307
    rlaager authored May 10, 2020
    Configuration menu
    Copy the full SHA
    7fcf824 View commit details
    Browse the repository at this point in the history

Commits on May 11, 2020

  1. Fix inconsistent capitalization in arcstat -v

    Reviewed-by: Richard Laager <rlaager@wiktel.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: AJ Jordan <alex@strugee.net>
    Closes openzfs#10288
    strugee authored and behlendorf committed May 11, 2020
    Configuration menu
    Copy the full SHA
    2b21da4 View commit details
    Browse the repository at this point in the history
  2. Import the arcstat(1m) manpage from illumos

    And move it from section 1m to section 1 for consistency.
    
    Imported from illumos commit f34d737f.
    
    Reviewed-by: Richard Laager <rlaager@wiktel.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: AJ Jordan <alex@strugee.net>
    Closes openzfs#10288
    strugee authored and behlendorf committed May 11, 2020
    Configuration menu
    Copy the full SHA
    ac806a2 View commit details
    Browse the repository at this point in the history
  3. Fix up arcstat(1) to match our version

    Turns out the illumos manpage, which is what this originates from, was
    written for the original Perl version of the utility which is not the
    version in the OpenZFS tree. *That* version originates from a Python
    rewrite that was done for FreeNAS. So fix up the manpage to match what
    we actually ship (and fix a few typos in the process).
    
    Reviewed-by: Richard Laager <rlaager@wiktel.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: AJ Jordan <alex@strugee.net>
    Closes openzfs#10288
    strugee authored and behlendorf committed May 11, 2020
    Configuration menu
    Copy the full SHA
    5a04b17 View commit details
    Browse the repository at this point in the history
  4. Fix outdated comment header

    Reviewed-by: Richard Laager <rlaager@wiktel.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: AJ Jordan <alex@strugee.net>
    Closes openzfs#10288
    strugee authored and behlendorf committed May 11, 2020
    Configuration menu
    Copy the full SHA
    b29e31d View commit details
    Browse the repository at this point in the history

Commits on May 13, 2020

  1. Resilver restarts unnecessarily when it encounters errors

    When a resilver finishes, vdev_dtl_reassess is called to hopefully
    excise DTL_MISSING (amongst other things). If there are errors during
    the resilver, they are tracked in DTL_SCRUB, as spelled out in the
    block comment in vdev.c. DTL_SCRUB is in-core only, so it can only
    be used if the pool was online for the whole resilver. This state is
    tracked with the spa_scrub_started flag, which only gets set when
    the scan is initialized. Unfortunately, this flag gets cleared right
    before vdev_dtl_reassess gets called, so if there are any errors
    during the scan, DTL_MISSING will never get excised and the resilver
    will just continually restart. This fix simply moves clearing that
    flag until after the call to vdev_dtl_reasses.
    
    In addition, if a pool is imported and already has scn_errors > 0,
    this change will restart the resilver immediately instead of doing
    the rest of the scan and then restarting it from the beginning. On
    the other hand, if scn_errors == 0 at import, then no errors have
    been encountered so far, so the spa_scrub_started flag can be safely
    set.
    
    A test has been added to verify that resilver does not restart when
    relevant DTL's are available.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Paul Zuchowski <pzuchowski@datto.com>
    Signed-off-by: John Poduska <jpoduska@datto.com>
    Closes openzfs#10291
    jwpoduska authored May 13, 2020
    Configuration menu
    Copy the full SHA
    41035a0 View commit details
    Browse the repository at this point in the history

Commits on May 14, 2020

  1. ZTS: zpool_split_indirect deletes zfstest log file

    The cleanup routine for this test attempts to remove some temporary
    files with `rm -f $VDEV_*`, but VDEV_ is undefined. As a result, all
    files in the current working directory (/var/tmp/test_results/current)
    get removed instead. This includes the complete log file of all tests.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: George Amanakis <gamanakis@gmail.com>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: John Kennedy <john.kennedy@delphix.com>
    Closes openzfs#10324
    jwk404 authored May 14, 2020
    Configuration menu
    Copy the full SHA
    e1fcd94 View commit details
    Browse the repository at this point in the history
  2. flake8 E741 variable name warning

    Update the zts-report.py script to conform to the flake8 E741 rule.
    
        "Variables named I, O, and l can be very hard to read. This is
        because the letter I and the letter l are easily confused, and
        the letter O and the number 0 can be easily confused."
    
    - https://www.flake8rules.com/rules/E741.html
    
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: John Kennedy <john.kennedy@delphix.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10323
    behlendorf authored May 14, 2020
    Configuration menu
    Copy the full SHA
    c87f958 View commit details
    Browse the repository at this point in the history
  3. remove unneeded member drc_err of dmu_recv_cookie_t

    The member drc_err of dmu_recv_cookie_t is used only locally in
    receive_read, so we can replace it with a local variable.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10319
    ahrens authored May 14, 2020
    Configuration menu
    Copy the full SHA
    8b240f1 View commit details
    Browse the repository at this point in the history
  4. Upstream: add missing thread_exit()

    Undo FreeBSD wrapper for thread_create() added to call thread_exit.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10314
    lundman authored May 14, 2020
    Configuration menu
    Copy the full SHA
    eeb8fae View commit details
    Browse the repository at this point in the history

Commits on May 15, 2020

  1. Fix abd_enter/exit_critical wrappers

    Commit fc551d7 introduced the wrappers abd_enter_critical() and
    abd_exit_critical() to mark critical sections.  On Linux these are
    implemented with the local_irq_save() and local_irq_restore() macros
    which set the 'flags' argument when saving.  By wrapping them with
    a function the local variable is no longer set by the macro and is
    no longer properly restored.
    
    Convert abd_enter_critical() and abd_exit_critical() to macros to
    resolve this issue and ensure the flags are properly restored.
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10332
    behlendorf authored May 15, 2020
    Configuration menu
    Copy the full SHA
    2ade659 View commit details
    Browse the repository at this point in the history
  2. Fix VN_OPEN_INVFS typo

    The VN_OPEN_INVFS literal is in the wrong field.
    
    Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Signed-off-by: yparitcher <y@paritcher.com>
    Closes openzfs#10322
    yparitcher authored May 15, 2020
    Configuration menu
    Copy the full SHA
    cdcce2f View commit details
    Browse the repository at this point in the history
  3. Fix error handling in receive_writer_thread()

    If `receive_writer_thread()` gets an error from `receive_process_record()`,
    it should be saved in `rwa->err` so that we will stop processing records,
    and the main thread will notice that the receive has failed.
    
    When an error is first encountered, this happens correctly.  However, if
    there are more records to dequeue, the next time through the loop we
    will reset `rwa->err` to zero, allowing us to try to process the
    following record (2 after the failed record).  Depending on what types
    of records remain, we may incorrectly complete the receive
    "successfully", but without actually having processed all the records.
    
    The fix is to only set `rwa->err` if we got a *non-zero* error.
    
    This bug was introduced by openzfs#10099 "Improve zfs receive performance by
    batching writes".
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Paul Dagnelie <pcd@delphix.com>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10320
    ahrens authored May 15, 2020
    Configuration menu
    Copy the full SHA
    1b9cd1a View commit details
    Browse the repository at this point in the history
  4. RPM: Remove old versions of DKMS on upgrade

    Due to a mismatch between the text and a regex looking for that text,
    the `%preuninstall` script would never run the `dkms remove` command
    necessary to avoid corrupting the DKMS data configuration.  Increase
    regex specificity to avoid this issue.
    
    Reviewed-by: Tony Hutter <hutter2@llnl.gov>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Chris Lindee <chris.lindee+github@gmail.com>
    Closes: openzfs#9891
    Closes openzfs#10327
    ColMelvin authored May 15, 2020
    Configuration menu
    Copy the full SHA
    4d6043f View commit details
    Browse the repository at this point in the history

Commits on May 16, 2020

  1. Fix ZVOL_DIR

    We only use ZVOL_DIR on FreeBSD, and on FreeBSD it isn't correct.
    
    Move the definition to the file where it is needed, and define it as
    /dev/zvol/.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10337
    Ryan Moeller authored May 16, 2020
    Configuration menu
    Copy the full SHA
    d2782af View commit details
    Browse the repository at this point in the history
  2. freebsd: return EISDIR for read(2) on directories

    This is arguably a change for internal consistency within OpenZFS, as the
    Linux implementation will reject read(2) on directories with EISDIR. It's
    not unreasonable for read(2) to do something here on FreeBSD, but we don't
    currently copy out anything useful anyways so start rejecting it with the
    appropriate error.
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
    Closes openzfs#10338
    kevans91 authored May 16, 2020
    Configuration menu
    Copy the full SHA
    5b090d5 View commit details
    Browse the repository at this point in the history

Commits on May 19, 2020

  1. Fix gcc 10.1 stringop-truncation error

    As we do not expect the destination of these strncpy calls to be NULL
    terminated, substitute them with memcpy.
    
    Reviewed-by: Tony Hutter <hutter2@llnl.gov>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: George Amanakis <gamanakis@gmail.com>
    Closes openzfs#10346
    gamanakis authored May 19, 2020
    Configuration menu
    Copy the full SHA
    7cd723e View commit details
    Browse the repository at this point in the history
  2. freebsd: Correct the order of arguments to copyin() for Q_SETQUOTA

    Sponsored by: DARPA
    External-issue: https://reviews.freebsd.org/D24656
    FreeBSD-commit: freebsd/freebsd-src@a431c09
    
    Authored by: jhb <jhb@FreeBSD.org>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Ported-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10344
    Ryan Moeller authored May 19, 2020
    Configuration menu
    Copy the full SHA
    7b0e390 View commit details
    Browse the repository at this point in the history

Commits on May 20, 2020

  1. Small program that converts a dataset id and an object id to a path

    Small program that converts a dataset id and an object id to a path
    
    Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Signed-off-by: Paul Dagnelie <pcd@delphix.com>
    Closes openzfs#10204
    pcd1193182 authored May 20, 2020
    Configuration menu
    Copy the full SHA
    de4f06c View commit details
    Browse the repository at this point in the history
  2. Use boot_ncpus in place of max_ncpus in taskq_create

    Due to hotplug support or BIOS bugs sometimes max_ncpus can be
    an absurdly high value. I have a system with 32 cores/threads
    but reports max_ncpus == 440. This many threads potentially
    cripples the system during arc_prune floods for example.
    
    boot_ncpus is the number of working CPUs when called so use
    that instead.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: DHE <git@dehacked.net>
    Closes openzfs#10282
    DeHackEd authored May 20, 2020
    Configuration menu
    Copy the full SHA
    57434ab View commit details
    Browse the repository at this point in the history

Commits on May 21, 2020

  1. mount: use the mount syscall directly

    Allow zfs datasets to be mounted on Linux without relying on the
    invocation of an external processes.  This is the same behavior
    which is implemented for FreeBSD.
    
    Use of the libmount library was originally considered because it 
    provides functionality to properly lock and update the /etc/mtab 
    file.  However, these days /etc/mtab is typically a symlink to 
    /proc/self/mounts so there's nothing to updated.  Therefore, we
    call mount(2) directly and avoid any additional dependencies. 
    
    If required the legacy behavior can be enabled by setting the 
    ZFS_MOUNT_HELPER environment variable.  This may be needed in
    environments where SELinux in enabled and the zfs binary does  
    not have mount permission.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Felix Dörre <felix@dogcraft.de>
    openzfs#10294
    felixdoerre authored May 21, 2020
    Configuration menu
    Copy the full SHA
    501a151 View commit details
    Browse the repository at this point in the history
  2. Gang ABD Type

    Adding the gang ABD type, which allows for linear and scatter ABDs to
    be chained together into a single ABD.
    
    This can be used to avoid doing memory copies to/from ABDs. An example
    of this can be found in vdev_queue.c in the vdev_queue_aggregate()
    function.
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Co-authored-by: Brian <bwa@clemson.edu>
    Co-authored-by: Mark Maybee <mmaybee@cray.com>
    Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
    Closes openzfs#10069
    bwatkinson authored May 21, 2020
    Configuration menu
    Copy the full SHA
    fb82226 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2020

  1. ZTS: Fix zfs_mount.kshlib cleanup

    Update cleanup_filesystem to use destroy_dataset when performing
    cleanup.  This ensures the destroy is retried if the pool is busy
    preventing occasional failures.
    
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10358
    behlendorf authored May 24, 2020
    Configuration menu
    Copy the full SHA
    c946d5a View commit details
    Browse the repository at this point in the history

Commits on May 26, 2020

  1. Fix dead links http://list.zfsonlinux.org

    Originally, I wanted to point to directly to
    https://zfsonlinux.topicbox.com/groups/zfs-discuss
    as the text refers to that specific mailing list, but George Melikov
    requested to change it to the general to give users the overview.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Signed-off-by: Marcel Schilling <marcel.schilling@uni-luebeck.de>
    Closes openzfs#10367
    Closes openzfs#10369
    mschilli87 authored May 26, 2020
    Configuration menu
    Copy the full SHA
    ce98ed2 View commit details
    Browse the repository at this point in the history
  2. Revert "Let zfs mount all tolerate in-progress mounts"

    This reverts commit a9cd8bf which introduced a segfault when running
    `zfs mount -a` multiple times when there are mountpoints which are
    not empty.  This segfault is now seen frequently by the CI after
    the mount code was updated to directly call mount(2).
    
    The original reason this logic was added is described in openzfs#8881.
    Since then the systemd `zfs-share.target` has been updated to run
    "After" the `zfs-mount.server` which should avoid this issue.
    
    Reviewed-by: Don Brady <don.brady@delphix.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#9560
    Closes openzfs#10364
    behlendorf authored May 26, 2020
    Configuration menu
    Copy the full SHA
    d1b84da View commit details
    Browse the repository at this point in the history
  3. Memory leak in dsl_destroy_snapshots_nvl error case

    The dsl_destroy_snapshots_nvl() function has an early error out, 
    and temporary nvlists were not freed.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10366
    lundman authored May 26, 2020
    Configuration menu
    Copy the full SHA
    70a5fc0 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2020

  1. ZTS: Retry export/destroy when busy in zpool_import_012

    It can take a moment for the NFS server to give up the mountpoint
    after unsharing a filesystem.
    
    Use log_must_busy to retry export/destroy a few times after switching
    off sharenfs.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Igor Kozhukhov <igor@dilos.org>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10380
    Ryan Moeller authored May 28, 2020
    Configuration menu
    Copy the full SHA
    4f8b235 View commit details
    Browse the repository at this point in the history
  2. etc/zfs/Makefile.am: set initconfdir

    The initconfdir variable is not defined in etc/zfs/Makefile,
    so the sed code does not perform the correct replacement.
    
    Reviewed-by: Richard Yao <ryao@gentoo.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
    Issue openzfs#10375 
    Closes openzfs#10376
    gyakovlev authored May 28, 2020
    Configuration menu
    Copy the full SHA
    40f96f4 View commit details
    Browse the repository at this point in the history
  3. Rework error handling in zpool_trim()

    When a manual trim is run against an entire pool, errors about
    particular devices which don't support trim are suppressed. This changes
    zpool_trim() in libzfs so that it doesn't return an error when the only
    errors are suppressed ones. An exception is made when none of the
    devices support trim, in which case an error is reported and a non-zero
    status is returned.
    
    This also fixes how the --wait flag works in the presence of suppressed
    errors. In particular, suppressed errors no longer cause zpool_trim()
    to skip the wait.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: John Gallagher <john.gallagher@delphix.com>
    Closes openzfs#10263 
    Closes openzfs#10372
    John Gallagher authored May 28, 2020
    Configuration menu
    Copy the full SHA
    50ff632 View commit details
    Browse the repository at this point in the history
  4. Correctly handle the x32 ABI

    __x86_64__ && _ILP32 => don't forcibly define _LP64
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@gmail.com>
    Closes openzfs#10357
    Closes openzfs#844
    nabijaczleweli authored and behlendorf committed May 28, 2020
    Configuration menu
    Copy the full SHA
    6059f3a View commit details
    Browse the repository at this point in the history
  5. Always use "%lld" for formatting time_ts

    Given the following test program:
      #include <time.h>
      #include <stdio.h>
      #include <stdint.h>
      int main() {
        printf("time_t:    %d\n", sizeof(time_t));
        printf("long:      %d\n", sizeof(long));
        printf("long long: %d\n", sizeof(long long));
      }
    
    These are output on various x86 architectures:
      x32$   time_t:    8
      x32$   long:      4
      x32$   long long: 8
    
      amd64$ time_t:    8
      amd64$ long:      8
      amd64$ long long: 8
    
      i386$  time_t:    4
      i386$  long:      4
      i386$  long long: 8
    
    Therefore code using "%l[du]" to format time_ts produced warnings on x32
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@gmail.com>
    Closes openzfs#10357
    Closes openzfs#844
    nabijaczleweli authored and behlendorf committed May 28, 2020
    Configuration menu
    Copy the full SHA
    a1ba120 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2020

  1. Update zfs-functions.in

    The init.d zfs-share script does not perform the intended 
    action without having a variable set for ZFS_SHARE and 
    ZFS_UNSHARE
    
    Assign default values to ZFS_SHARE and ZFS_UNSHARE. Export 
    the environment variables after sourcing the configuration 
    file.
    
    Reviewed-by: Richard Yao <ryao@gentoo.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Georgy Yakovlev <gyakovlev@gentoo.org>
    Signed-off-by: Allen Holl <allen.m.holl@gmail.com>
    Closes openzfs#10341 
    Closes openzfs#10382
    allen-4 authored May 29, 2020
    Configuration menu
    Copy the full SHA
    4d829ad View commit details
    Browse the repository at this point in the history

Commits on May 30, 2020

  1. ztest: Fix ztest_run_zdb() failure

    It's possible for ztest to be killed while the pool is exported
    which results in an empty cache file.  This is a valid state to
    test, but the validation check performed by ztest_run_zdb()
    depends on the pool being in the cache file.  If it's not the
    following error is printed.
    
        zdb -bccsv -G -d -Y -U /tmp/zloop-run/zpool.cache ztest
        zdb: can't open '/tmp/zloop-run': No such file or directory
    
    Resolve these failures by removing the dependency on the cache
    file.  Functionally, we only care that the pool can be imported
    and that the zdb verification passes.
    
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10385
    behlendorf authored May 30, 2020
    Configuration menu
    Copy the full SHA
    3d93161 View commit details
    Browse the repository at this point in the history
  2. Add bootfs.snapshot and bootfs.rollback kernel parameters

    Unlike other filesystems, snapshots and rollbacks of bootfs need to be
    done from a rescue environment. This patch makes it possible to snap-
    shot or rollback the bootfs simply by specifying bootfs.snapshot or
    bootfs.rollback on the kernel command line. The operation will be
    performed by dracut just before bootfs is mounted.
    
    Reviewed-by: Antonio Russo <antonio.e.russo@gmail.com> 
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Gregory Bartholomew <gregory.lee.bartholomew@gmail.com>
    Closes openzfs#10198
    gregory-lee-bartholomew authored May 30, 2020
    Configuration menu
    Copy the full SHA
    9052e3d View commit details
    Browse the repository at this point in the history
  3. Fix crypto build on FreeBSD HEAD

    Update API usage to reflect recent change.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
    Closes openzfs#10384
    mattmacy authored May 30, 2020
    Configuration menu
    Copy the full SHA
    3bf3b16 View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2020

  1. Restore avl_update() calls and related functions

    The macOS kmem implementation uses avl_update() and related
    functions.  These same function exist in the Solaris AVL code but
    were removed because they were unused.  Restore them.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10390
    lundman authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    081de9a View commit details
    Browse the repository at this point in the history
  2. Periodically update ARC kstats

    FreeBSD needs arc_adjust_zthr to run periodically for kstats to be
    updated.  A comment in the code suggests this may have been the
    original intent in illumos as well:
    
    https://github.com/openzfs/zfs/blob/c946d5a91329b075fb9bda1ac703a2e85139cf1c/module/zfs/arc.c#L4697-L4700
    
    Create the thread with a 1 second timer.
    
    Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10371
    Ryan Moeller authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    a9dcfac View commit details
    Browse the repository at this point in the history
  3. FreeBSD: Simplify zvol and fix locking

    zvol_geom_bio_strategy should handle its own use of the zvol
    suspend reader lock and ensure the zilog exists when needed.
    
    A few other places using the zvol zilog should use the suspend
    reader lock as well.
    
    Simplify consumers of zvol_geom_bio_strategy, fix the locking, and
    while in here, use the boolean_t constants with doread.
    
    Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10381
    Ryan Moeller authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    c0eb5c3 View commit details
    Browse the repository at this point in the history
  4. zfsvfs_setup(): zap_stats_t may have undefined content when accessed

    Signed-off-by: Allan Jude <allanjude@klarasystems.com>
    Allan Jude authored and allanjude committed Jun 3, 2020
    Configuration menu
    Copy the full SHA
    7da304b View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2020

  1. Update wiki links with new address

    Use direct links to new documentation resource.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: George Melikov <mail@gmelikov.ru>
    Closes openzfs#10395
    gmelikov authored Jun 4, 2020
    Configuration menu
    Copy the full SHA
    52998c7 View commit details
    Browse the repository at this point in the history
  2. Fix double mutex_init bug in send code

    It was possible to cause a kernel panic in the send code by 
    initializing an already-initialized mutex, if a record was created 
    with type DATA, destroyed with a different type (bypassing the 
    mutex_destroy call) and then re-allocated as a DATA record again.
    
    We tweak the logic to not change the type of a record once it has 
    been created, avoiding the issue.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Jorgen Lundman <lundman@lundman.net>
    Signed-off-by: Paul Dagnelie <pcd@delphix.com>
    Closes openzfs#10374
    pcd1193182 authored Jun 4, 2020
    Configuration menu
    Copy the full SHA
    99b281f View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2020

  1. Connect dataset_kstats for FreeBSD

    Expand the FreeBSD spl for kstats to support all current types
    
    Move the dataset_kstats_t back to zvol_state_t from zfs_state_os_t
    now that it is common once again
    
    ```
    kstat.zfs/mypool.dataset.objset-0x10b.nunlinked: 0
    kstat.zfs/mypool.dataset.objset-0x10b.nunlinks: 0
    kstat.zfs/mypool.dataset.objset-0x10b.nread: 150528
    kstat.zfs/mypool.dataset.objset-0x10b.reads: 48
    kstat.zfs/mypool.dataset.objset-0x10b.nwritten: 134217728
    kstat.zfs/mypool.dataset.objset-0x10b.writes: 1024
    kstat.zfs/mypool.dataset.objset-0x10b.dataset_name: mypool/datasetname
    ```
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed by: Sean Eric Fagan <sef@ixsystems.com>
    Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Allan Jude <allan@klarasystems.com>
    Closes openzfs#10386
    allanjude authored Jun 6, 2020
    Configuration menu
    Copy the full SHA
    4547fc4 View commit details
    Browse the repository at this point in the history
  2. zfsvfs_setup(): zap_stats_t may have undefined content when accessed (o…

    …penzfs#10398)
    
    Signed-off-by: Allan Jude <allanjude@klarasystems.com>
    
    Co-authored-by: Allan Jude <allanjude@klarasystems.com>
    behlendorf and Allan Jude authored Jun 6, 2020
    Configuration menu
    Copy the full SHA
    63761a8 View commit details
    Browse the repository at this point in the history
  3. mkfile: include missing headers

    Without these headers, compilation fails on musl libc with offset_t
    being undeclared and MIN being implictly declared.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Hiếu Lê <leorize+oss@disroot.org>
    Closes openzfs#10406
    alaviss authored Jun 6, 2020
    Configuration menu
    Copy the full SHA
    13dd63f View commit details
    Browse the repository at this point in the history
  4. ztest: Fix spa_open() ENOENT failures

    The pool may not be imported when the previous pass is terminated.
    In which case, spa_open() will return ENOENT to indicate the pool
    is not currently imported.  Refactor to code slightly to handle
    this case by importing the pool and then retrying the spa_open().
    
    The ztest_import() function was moved before ztest_run() and the
    import logic split in to a small internal helper function.  The
    ztest_freeze() function was also moved but no changes were made.
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#10407
    behlendorf authored Jun 6, 2020
    Configuration menu
    Copy the full SHA
    c1f3de1 View commit details
    Browse the repository at this point in the history
  5. Improve compatibility with C++ consumers

    C++ is a little picky about not using keywords for names, or string
    constness.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Jorgen Lundman <lundman@lundman.net>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10409
    Ryan Moeller authored Jun 6, 2020
    Configuration menu
    Copy the full SHA
    6026507 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2020

  1. Replace sprintf()->snprintf() and strcpy()->strlcpy()

    The strcpy() and sprintf() functions are deprecated on some platforms.
    Care is needed to ensure correct size is used.  If some platforms
    miss snprintf, we can add a #define to sprintf, likewise strlcpy().
    
    The biggest change is adding a size parameter to zfs_id_to_fuidstr().
    
    The various *_impl_get() functions are only used on linux and have
    not yet been updated.
    
    Reviewed by: Sean Eric Fagan <sef@ixsystems.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10400
    lundman authored Jun 7, 2020
    Configuration menu
    Copy the full SHA
    c9e319f View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2020

  1. Don't erase final byte of envblock

    When we copy the envblock's contents out, we currently treat it as 
    a normal C string. However, this functionality is supposed to more
    closely emulate interacting with a file. As a consequence, we were 
    incorrectly truncating the contents of the envblock by replacing 
    the final byte of the buffer with a null character.
    
    Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Paul Dagnelie <pcd@delphix.com>
    Closes openzfs#10405
    pcd1193182 authored Jun 8, 2020
    Configuration menu
    Copy the full SHA
    b2f3709 View commit details
    Browse the repository at this point in the history
  2. Remove redundant includes

    By removing excessive includes it takes us a small step close to
    compiling this file in userland.
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by:	Pawel Jakub Dawidek <pawel@dawidek.net>
    Closes openzfs#10415
    pjd authored Jun 8, 2020
    Configuration menu
    Copy the full SHA
    77b998f View commit details
    Browse the repository at this point in the history
  3. Restore support for in-kernel ZFS ioctls

    In Illumos it is possible to call ioctl functions from within the
    kernel by passing the FKIOCTL flag. Neither FreeBSD nor Linux support
    that, but it doesn't hurt to keep it around, as all the code is there.
    
    Before this commit it was a dead code and zc_iflags was always zero.
    Restore this functionality by allowing to pass a flag to the
    zfsdev_ioctl_common() function.
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by:	Pawel Jakub Dawidek <pawel@dawidek.net>
    Closes openzfs#10417
    pjd authored Jun 8, 2020
    Configuration menu
    Copy the full SHA
    529246d View commit details
    Browse the repository at this point in the history
  4. Linux 5.8 compat: __vmalloc()

    The `pgprot` argument has been removed from `__vmalloc` in Linux 5.8,
    being `PAGE_KERNEL` always now [1].
    
    Detect this during configure and define a wrapper for older kernels.
    
    [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/mm/vmalloc.c?h=next-20200605&id=88dca4ca5a93d2c09e5bbc6a62fbfc3af83c4fca
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Co-authored-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
    Co-authored-by: Michael Niewöhner <foss@mniewoehner.de>
    Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
    Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
    Closes openzfs#10422
    c0d3z3r0 authored Jun 8, 2020
    Configuration menu
    Copy the full SHA
    080102a View commit details
    Browse the repository at this point in the history
  5. Move GFP flags kernel compatibility code

    Move the GFP flags kernel compat code from c file to kmem header.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
    Closes openzfs#10424
    c0d3z3r0 authored Jun 8, 2020
    Configuration menu
    Copy the full SHA
    32f26ea View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2020

  1. Trim L2ARC

    The l2arc_evict() function is responsible for evicting buffers which
    reference the next bytes of the L2ARC device to be overwritten. Teach
    this function to additionally TRIM that vdev space before it is
    overwritten if the device has been filled with data. This is done by
    vdev_trim_simple() which trims by issuing a new type of TRIM,
    TRIM_TYPE_SIMPLE.
    
    We also implement a "Trim Ahead" feature. It is a zfs module parameter,
    expressed in % of the current write size. This trims ahead of the
    current write size. A minimum of 64MB will be trimmed. The default is 0
    which disables TRIM on L2ARC as it can put significant stress to
    underlying storage devices. To enable TRIM on L2ARC we set
    l2arc_trim_ahead > 0.
    
    We also implement TRIM of the whole cache device upon addition to a
    pool, pool creation or when the header of the device is invalid upon
    importing a pool or onlining a cache device. This is dependent on
    l2arc_trim_ahead > 0. TRIM of the whole device is done with
    TRIM_TYPE_MANUAL so that its status can be monitored by zpool status -t.
    We save the TRIM state for the whole device and the time of completion
    on-disk in the header, and restore these upon L2ARC rebuild so that
    zpool status -t can correctly report them. Whole device TRIM is done
    asynchronously so that the user can export of the pool or remove the
    cache device while it is trimming (ie if it is too slow).
    
    We do not TRIM the whole device if persistent L2ARC has been disabled by
    l2arc_rebuild_enabled = 0 because we may not want to lose all cached
    buffers (eg we may want to import the pool with
    l2arc_rebuild_enabled = 0 only once because of memory pressure). If
    persistent L2ARC has been disabled by setting the module parameter
    l2arc_rebuild_blocks_min_l2size to a value greater than the size of the
    cache device then the whole device is trimmed upon creation or import of
    a pool if l2arc_trim_ahead > 0.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Adam D. Moss <c@yotes.com>
    Signed-off-by: George Amanakis <gamanakis@gmail.com>
    Closes openzfs#9713
    Closes openzfs#9789 
    Closes openzfs#10224
    gamanakis authored Jun 9, 2020
    Configuration menu
    Copy the full SHA
    b7654bd View commit details
    Browse the repository at this point in the history
  2. ZTS: Fix add-o_ashift.ksh

    Use option '-o' after action for compatibility
    
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Igor Kozhukhov <igor@dilos.org>
    Closes openzfs#10426
    ikozhukhov authored Jun 9, 2020
    Configuration menu
    Copy the full SHA
    6722be2 View commit details
    Browse the repository at this point in the history
  3. File incorrectly zeroed when receiving incremental stream that toggle…

    …s -L
    
    Background:
    
    By increasing the recordsize property above the default of 128KB, a
    filesystem may have "large" blocks.  By default, a send stream of such a
    filesystem does not contain large WRITE records, instead it decreases
    objects' block sizes to 128KB and splits the large blocks into 128KB
    blocks, allowing the large-block filesystem to be received by a system
    that does not support the `large_blocks` feature.  A send stream
    generated by `zfs send -L` (or `--large-block`) preserves the large
    block size on the receiving system, by using large WRITE records.
    
    When receiving an incremental send stream for a filesystem with large
    blocks, if the send stream's -L flag was toggled, a bug is encountered
    in which the file's contents are incorrectly zeroed out.  The contents
    of any blocks that were not modified by this send stream will be lost.
    "Toggled" means that the previous send used `-L`, but this incremental
    does not use `-L` (-L to no-L); or that the previous send did not use
    `-L`, but this incremental does use `-L` (no-L to -L).
    
    Changes:
    
    This commit addresses the problem with several changes to the semantics
    of zfs send/receive:
    
    1. "-L to no-L" incrementals are rejected.  If the previous send used
    `-L`, but this incremental does not use `-L`, the `zfs receive` will
    fail with this error message:
    
        incremental send stream requires -L (--large-block), to match
        previous receive.
    
    2. "no-L to -L" incrementals are handled correctly, preserving the
    smaller (128KB) block size of any already-received files that used large
    blocks on the sending system but were split by `zfs send` without the
    `-L` flag.
    
    3. A new send stream format flag is added, `SWITCH_TO_LARGE_BLOCKS`.
    This feature indicates that we can correctly handle "no-L to -L"
    incrementals.  This flag is currently not set on any send streams.  In
    the future, we intend for incremental send streams of snapshots that
    have large blocks to use `-L` by default, and these streams will also
    have the `SWITCH_TO_LARGE_BLOCKS` feature set. This ensures that streams
    from the default use of `zfs send` won't encounter the bug mentioned
    above, because they can't be received by software with the bug.
    
    Implementation notes:
    
    To facilitate accessing the ZPL's generation number,
    `zfs_space_delta_cb()` has been renamed to `zpl_get_file_info()` and
    restructured to fill in a struct with ZPL-specific info including owner
    and generation.
    
    In the "no-L to -L" case, if this is a compressed send stream (from
    `zfs send -cL`), large WRITE records that are being written to small
    (128KB) blocksize files need to be decompressed so that they can be
    written split up into multiple blocks.  The zio pipeline will recompress
    each smaller block individually.
    
    A new test case, `send-L_toggle`, is added, which tests the "no-L to -L"
    case and verifies that we get an error for the "-L to no-L" case.
    
    Reviewed-by: Paul Dagnelie <pcd@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#6224 
    Closes openzfs#10383
    ahrens authored Jun 9, 2020
    Configuration menu
    Copy the full SHA
    7bcb7f0 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2020

  1. Fix typos

    Correct various typos in the comments and tests.
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net>
    Closes openzfs#10423
    Gelma authored Jun 10, 2020
    Configuration menu
    Copy the full SHA
    dd4bc56 View commit details
    Browse the repository at this point in the history
  2. Cleanup linux module kbuild files

    The linux module can be built either as an external module, or compiled
    into the kernel, using copy-builtin. The source and build directories
    are slightly different between the two cases, and currently, compiling
    into the kernel still refers to some files from the configured ZFS
    source tree, instead of the copies inside the kernel source tree. There
    is also duplication between copy-builtin, which creates a Kbuild file to
    build ZFS inside the kernel tree, and the top-level module/Makefile.in.
    
    Fix this by moving the list of modules and the CFLAGS settings into a
    new module/Kbuild.in, which will be used by the kernel kbuild
    infrastructure, and using KBUILD_EXTMOD to distinguish the two cases
    within the Makefiles, in order to choose appropriate include
    directories etc.
    
    Module CFLAGS setting is simplified by using subdir-ccflags-y (available
    since 2.6.30) to set them in the top-level Kbuild instead of each
    individual module. The disabling of -Wunused-but-set-variable is removed
    from the lua and zfs modules. The variable that the Makefile uses is
    actually not defined, so this has no effect; and the warning has long
    been disabled by the kernel Makefile itself.
    
    The target_cpu definition in module/{zfs,zcommon} is removed as it was
    replaced by use of CONFIG_SPARC64 in
      commit 70835c5 ("Unify target_cpu handling")
    
    os/linux/{spl,zfs} are removed from obj-m, as they are not modules in
    themselves, but are included by the Makefile in the spl and zfs module
    directories. The vestigial Makefiles in os and os/linux are removed.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
    Closes openzfs#10379
    Closes openzfs#10421
    nivedita76 authored and behlendorf committed Jun 10, 2020
    Configuration menu
    Copy the full SHA
    7150427 View commit details
    Browse the repository at this point in the history
  3. Fix VPATH builds for user config

    cmd/zpool and lib/libzutil Makefile's use -I., which won't work with a
    VPATH build. Replace it with -I$(srcdir) instead.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
    Closes openzfs#10379
    Closes openzfs#10421
    nivedita76 authored and behlendorf committed Jun 10, 2020
    Configuration menu
    Copy the full SHA
    66786f7 View commit details
    Browse the repository at this point in the history
  4. Fixup "Avoid the GEOM topology lock recursion when autoexpanding a pool"

    The patch was applied to vdev_geom_open instead of vdev_geom_close by
    mistake.
    
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10427
    Ryan Moeller authored Jun 10, 2020
    Configuration menu
    Copy the full SHA
    feff3f6 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2020

  1. Remove unnecessary references to slavery

    The horrible effects of human slavery continue to impact society.  The
    casual use of the term "slave" in computer software is an unnecessary
    reference to a painful human experience.
    
    This commit removes all possible references to the term "slave".
    
    Implementation notes:
    
    The zpool.d/slaves script is renamed to dm-deps, which uses the same
    terminology as `dmsetup deps`.
    
    References to the `/sys/class/block/$dev/slaves` directory remain.  This
    directory name is determined by the Linux kernel.  Although
    `dmsetup deps` provides the same information, it unfortunately requires
    elevated privileges, whereas the `/sys/...` directory is world-readable.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10435
    ahrens authored Jun 11, 2020
    Configuration menu
    Copy the full SHA
    f664342 View commit details
    Browse the repository at this point in the history
  2. bash_completion: add missing attributes

    There a some attributes missing which are shown in man pages:
    zfs list -t type
               A comma-separated list of types to display, where type is one of filesystem, snapshot, volume, *bookmark*, or all.  For example, specifying -t snapshot displays only snapshots.
    zfs get -s source
               A comma-separated list of sources to display.  Those properties coming from a source other than those in this list are ignored.  Each source must be one of the following: local, default, inherited, temporary, *received*, and none.  The default value is all sources.
    zfs get -t type
               A comma-separated list of types to display, where type is one of filesystem, snapshot, volume, bookmark, or all.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Grischa Zengel <github.zfsonlinux@zengel.info>
    Closes openzfs#10418
    ggzengel authored Jun 11, 2020
    Configuration menu
    Copy the full SHA
    2bc07c6 View commit details
    Browse the repository at this point in the history
  3. man.8: Add bookmark to list of types

    While checking bash_completion I missed bookmark as type.
    
    ```
    # zfs get type zpool2#b
    NAME      PROPERTY  VALUE     SOURCE
    zpool2#b  type      bookmark  -
    ```
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: George Melikov <mail@gmelikov.ru>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Grischa Zengel <github.zfsonlinux@zengel.info>
    Closes openzfs#10419
    ggzengel authored Jun 11, 2020
    Configuration menu
    Copy the full SHA
    059f7c2 View commit details
    Browse the repository at this point in the history
  4. Removing ZERO_PAGE abd_alloc_zero_scatter

    For MIPS architectures on Linux the ZERO_PAGE macro references
    empty_zero_page, which is exported as a GPL symbol. The call to
    ZERO_PAGE in abd_alloc_zero_scatter has been removed and a single
    zero'd page is now allocated for each of the pages in abd_zero_scatter
    in the kernel ABD code path.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
    Closes openzfs#10428
    bwatkinson authored Jun 11, 2020
    Configuration menu
    Copy the full SHA
    e08b993 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2020

  1. FreeBSD: Don't require zeroing new locks before init

    This has not shown to be of use enough to justify the inconvenience.
    
    Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Reviewed-by: Allan Jude <allanjude@freebsd.org>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10449
    Ryan Moeller authored Jun 13, 2020
    Configuration menu
    Copy the full SHA
    499dccd View commit details
    Browse the repository at this point in the history
  2. Fix gcc10.1 truncation error

    gcc10.1 complains with:
    
    ../../include/sys/dmu.h:373:24: error: ‘%s’ directive output may be
    truncated writing up to 95 bytes into a region of size 75
    [-Werror=format-truncation=]
      373 | #define DMU_POOL_DDT   "DDT-%s-%s-%s"
          |                        ^~~~~~~~~~~~~~
    ../../module/zfs/ddt.c:256:37: note: in expansion of macro
    ‘DMU_POOL_DDT’
      256 |  (void) snprintf(name, DDT_NAMELEN, DMU_POOL_DDT,
          |                                     ^~~~~~~~~~~~
    ../../include/sys/dmu.h:373:32: note: format string is defined here
      373 | #define DMU_POOL_DDT   "DDT-%s-%s-%s"
          |                                ^~
    ../../module/zfs/ddt.c:256:9: note: ‘snprintf’ output 7 or more bytes
    (assuming 102) into a destination of size 80
      256 |  (void) snprintf(name, DDT_NAMELEN, DMU_POOL_DDT,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      257 |      zio_checksum_table[ddt->ddt_checksum].ci_name,
          |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      258 |      ddt_ops[type]->ddt_op_name, ddt_class_name[class]);
          |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Increasing DTT_NAMELEN fixes it.
    
    Reviewed-By: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: George Amanakis <gamanakis@gmail.com>
    Closes openzfs#10433
    gamanakis authored Jun 13, 2020
    Configuration menu
    Copy the full SHA
    f2edc00 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2020

  1. Upstream: zil_commit_waiter() can stall forever

    On macOS clock_t is unsigned, so when cv_timedwait_hires() returns -1
    we loop forever. The conditional was tweaked to ignore signedness.
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10445
    lundman authored Jun 14, 2020
    Configuration menu
    Copy the full SHA
    4f73576 View commit details
    Browse the repository at this point in the history
  2. Add convenience wrappers for common uio usage

    The macOS uio struct is opaque and the API must be used, this
    makes the smallest changes to the code for all platforms.
    
    Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10412
    lundman authored Jun 14, 2020
    Configuration menu
    Copy the full SHA
    883a40f View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2020

  1. Fix FreeBSD condvar semantics

    We should return -1 instead of negative deltas, and 0 if signaled.
    
    Reviewed-by: Alexander Motin <mav@FreeBSD.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: Jorgen Lundman <lundman@lundman.net>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10460
    Ryan Moeller authored Jun 16, 2020
    Configuration menu
    Copy the full SHA
    c13facb View commit details
    Browse the repository at this point in the history
  2. Fixing ABD struct allocation for FreeBSD

    In the event we are allocating a gang ABD in FreeBSD we are passing 0
    to abd_alloc_struct(); however, this led to an allocation of ABD scatter
    with 0 chunks. This left the gang ABD allocation 24 bytes smaller than
    it should have been.
    
    Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Co-authored-by: Matt Macy <mmacy@FreeBSD.org>
    Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
    Closes openzfs#10431
    bwatkinson authored Jun 16, 2020
    Configuration menu
    Copy the full SHA
    0a03495 View commit details
    Browse the repository at this point in the history
  3. Remove refences to blacklist/whitelist

    These terms reinforce the incorrect notion that black is bad and white
    is good.
    
    Replace this language with more specific terms which are also more clear
    and don't rely on metaphor.  Specifically:
    
    * When vdevs are specified on the command line, they are the "selected"
    vdevs.
    
    * Entries in /dev/ which should not be considered as possible disks are
    "excluded" devices.
    
    Reviewed-by: John Kennedy <john.kennedy@delphix.com>
    Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Reviewed-by: George Wilson <gwilson@delphix.com>
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    Closes openzfs#10457
    ahrens authored Jun 16, 2020
    Configuration menu
    Copy the full SHA
    ba54b18 View commit details
    Browse the repository at this point in the history
  4. Make struct vdev_disk_t be platform private

    Linux defines different vdev_disk_t members to macOS, but they are
    only used in vdev_disk.c so move the declaration there.
    
    Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10452
    lundman authored Jun 16, 2020
    Configuration menu
    Copy the full SHA
    d366c8f View commit details
    Browse the repository at this point in the history
  5. FreeBSD: Kernel module should depend on xdr not krpc after 1300092

    Since https://reviews.freebsd.org/D24408 FreeBSD provides XDR functions
    in the xdr module instead of krpc.
    
    For FreeBSD 13, the MODULE_DEPEND should be changed to xdr
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
    Closes openzfs#10442 
    Closes openzfs#10443
    Ryan Moeller authored Jun 16, 2020
    Configuration menu
    Copy the full SHA
    86a0f49 View commit details
    Browse the repository at this point in the history
  6. drr_begin: can't forward declare untagged struct

    When compiling with Clang++ it does not allow for untagged structs, so
    struct ddr_begin needs to be declared before the struct that uses it.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10453
    lundman authored Jun 16, 2020
    Configuration menu
    Copy the full SHA
    cd07d7c View commit details
    Browse the repository at this point in the history
  7. Merge bash_completions changes from upstream

    The current bash_completion contrib code in openzfs is very old, and
    some changes have been added since.
    
    The original repo is at https://github.com/Aneurin/zfs-bash
    
    I've been using the original @Aneurin code since my first deploy of ZoL.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: João Carlos Mendes Luís <jonny@jonny.eng.br>
    Closes openzfs#10456
    dioni21 authored Jun 16, 2020
    Configuration menu
    Copy the full SHA
    fccaea4 View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2020

  1. Set initial arc_c to arc_c_min instead of arc_c_max

    For at least 15 years since OpenSolaris arc_c was set by default to
    arc_c_max, later decreased under memory pressure.  I've noticed that
    if arc_c was set high enough to cause memory pressure as considered
    by ZFS, setting of arc_no_grow to TRUE in arc_reap_cb_check() makes
    no effect until both arc_kmem_reap_soon() and delay(reap_retry_ms)
    return.  All that time ZFS can continue increasing its effective ARC
    size, causing more memory pressure, potentially up to the point when
    OS low memory handler activates and reduces arc_c, requesting fast
    reclamation of just allocated memory.
    
    The problem seems to be more serious on FreeBSD and I guess Linux,
    since neither of them implement/use asynchronous kmem reclamation,
    so arc_kmem_reap_soon() can take more time.  On older FreeBSD 11 not
    supporting multiple memory domains system with lots of RAM can get
    completely unresponsive for minutes due to heavy lock congestion
    between ARC reclamation and page daemon kmem reclamation threads.
    With this change to more conservative arc_c value ARC stops growing
    just it time and does not need later reclamation.
    
    Also while there, since now growing arc_c is a more often situation,
    use aggsum_upper_bound() instead of aggsum_compare() in arc_adapt()
    to reduce lock congestion.  It is also getting in sync with code in
    arc_get_data_impl().
    
    Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
    Reviewed-by: Allan Jude <allanjude@freebsd.org>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Alexander Motin <mav@FreeBSD.org>
    Sponsored-By: iXsystems, Inc.
    Closes openzfs#10437
    amotin authored Jun 17, 2020
    Configuration menu
    Copy the full SHA
    17ca301 View commit details
    Browse the repository at this point in the history
  2. zfs_ioctl: saved_poolname can be truncated

    As it uses kmem_strdup() and kmem_strfree() which both rely on
    strlen() being the same, but saved_poolname can be truncated causing:
    
    SPL: kernel memory allocator:
    buffer freed to wrong cache
    SPL: buffer was allocated from kmem_alloc_16,
    SPL: caller attempting free to kmem_alloc_8.
    SPL: buffer=0xffffff90acc66a38  bufctl=0x0  cache: kmem_alloc_8
    
    Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Jorgen Lundman <lundman@lundman.net>
    Closes openzfs#10469
    lundman authored Jun 17, 2020
    Configuration menu
    Copy the full SHA
    4458157 View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2020

  1. Configuration menu
    Copy the full SHA
    107b024 View commit details
    Browse the repository at this point in the history