Displaying 1 50 of 5,113 commits (0.008s)

ZFS on Linux — module/zfs vdev_indirect.c

Fix CONFIG_GCC_PLUGIN_RANDSTRUCT build

Fix build errors with gcc 7.3.0 on Gentoo with kernel 4.16.3
built with CONFIG_GCC_PLUGIN_RANDSTRUCT=y such as:

module/zfs/vdev_indirect.c:296:2: error:
positional initialization of field in ‘struct’ declared with
‘designated_init’ attribute [-Werror=designated-init]
  vdev_indirect_map_free,
  ^~~~~~~~~~~~~~~~~~~~~~

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: Mark Wright <gienah at gentoo.org>
Closes #7464
Delta File
+2 -2 module/zfs/vdev_indirect.c
+2 -2 1 file

ZFS on Linux — . configure.ac, cmd/zfs zfs_main.c

Fix 'zfs remap <poolname at snapname>'

Only filesystems and volumes are valid 'zfs remap' parameters: when
passed a snapshot name zfs_remap_indirects() does not handle the
EINVAL returned from libzfs_core, which results in failing an assertion
and consequently crashing.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #7454

ZFS on Linux — . configure.ac, include/sys zap_leaf.h

Fix ENOSPC in "Handle zap_add() failures in ..."

Commit cc63068 caused ENOSPC error when copy a large amount of files
between two directories. The reason is that the patch limits zap leaf
expansion to 2 retries, and return ENOSPC when failed.

The intent for limiting retries is to prevent pointlessly growing table
to max size when adding a block full of entries with same name in
different case in mixed mode. However, it turns out we cannot use any
limit on the retry. When we copy files from one directory in readdir
order, we are copying in hash order, one leaf block at a time. Which
means that if the leaf block in source directory has expanded 6 times,
and you copy those entries in that block, by the time you need to expand
the leaf in destination directory, you need to expand it 6 times in one
go. So any limit on the retry will result in error where it shouldn't.

Note that while we do use different salt for different directories, it
seems that the salt/hash function doesn't provide enough randomization
to the hash distance to prevent this from happening.

Since cc63068 has already been reverted. This patch adds it back and
removes the retry limit.

Also, as it turn out, failing on zap_add() has a serious side effect for
mzap_upgrade(). When upgrading from micro zap to fat zap, it will

    [13 lines not shown]

ZFS on Linux — cmd/zstreamdump zstreamdump.c, module/zfs dmu_send.c

Fix issues with raw sends of spill blocks

This patch fixes 2 issues in how spill blocks are processed during
raw sends. The first problem is that compressed spill blocks were
using the logical length rather than the physical length to
determine how much data to dump into the send stream. The second
issue is a typo that caused the spill record's object number to be
used where the objset's ID number was required. Both issues have
been corrected, and the payload_size is now printed in zstreamdump
for future debugging.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7378
Closes #7432

ZFS on Linux — module/zfs dmu_send.c dnode.c, tests/zfs-tests/tests/functional/rsend send_realloc_dnode_size.ksh

Fix object reclaim when using large dnodes

Currently, when the receive_object() code wants to reclaim an
object, it always assumes that the dnode is the legacy 512 bytes,
even when the incoming bonus buffer exceeds this length. This
causes a buffer overflow if --enable-debug is not provided and
triggers an ASSERT if it is. This patch resolves this issue and
adds an ASSERT to ensure this can't happen again.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7097
Closes #7433

ZFS on Linux — include/sys dbuf.h dmu.h, module/zfs dmu.c dmu_send.c

assertion in arc_release() during encrypted receive

In the existing code, when doing a raw (encrypted) zfs receive,
we call arc_convert_to_raw() from open context. This creates a
race condition between arc_release()/arc_change_state() and
writing out the block from syncing context (arc_write_ready/done()).

This change makes it so that when we are doing a raw (encrypted)
zfs receive, we save the crypt parameters (salt, iv, mac) of dnode
blocks in the dbuf_dirty_record_t, and call arc_convert_to_raw()
from syncing context when writing out the block of dnodes.

Additionally, we can eliminate dr_raw and associated setters, and
instead know that dnode blocks are always raw when doing a zfs
receive (see the new field os_raw_receive).

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tom Caputi <tcaputi at datto.com>
Signed-off-by: Matthew Ahrens <mahrens at delphix.com>
Closes #7424
Closes #7429

ZFS on Linux — tests/zfs-tests/tests/functional/reservation reservation_013_pos.sh

ZTS: fix reservation_013_pos integer overflow

When using large disks the integers for calculating sizes can
overflow past 2**31.  Changing to long integers with typeset
should correct this.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: bunder2015 <omfgbunder at gmail.com>
Closes #4444
Closes #7451

ZFS on Linux — module/zfs vdev_indirect_mapping.c

Revert "OpenZFS 9036 - zfs: duplicate 'const' declaration specifier"

This reverts commit cbb893321545c2c9052787b556c9375fcb103979.

The original change in OpenZFS 9036 did remove duplicate 'const'
specifiers, but the ZoL port had already done what *should* have been
done in OpenZFS 9036, which is to make the pointers themselves const.
The port of the change to ZoL ended up doing an unnecessary removal
of the constness of the pointers. Undo that.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tim Chase <tim at chase2k.com>
Signed-off-by: Ari Sundholm <ari at tuxera.com>
Closes #7444

ZFS on Linux — tests/zfs-tests/tests/functional/cli_root/zpool_create zpool_create_002_pos.ksh

ZTS: zpool_create_002 clean up leftover filedisk

zpool_create_002_pos did not clean up filedisk files left over from
running the test.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: bunder2015 <omfgbunder at gmail.com>
Closes #7435
Closes #7439

ZFS on Linux — module/zfs zthr.c

Avoid Linux hung task message in ZTHR

Use an interruptible to avoid Linux hung task message in
ZTHR and to prevent inflating the load average.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tim Chase <tim at chase2k.com>
Closes #7440
Closes #7441
Delta File
+1 -1 module/zfs/zthr.c
+1 -1 1 file

ZFS on Linux — tests/zfs-tests/tests/functional/cli_root/zfs_receive zfs_receive_raw_incremental.ksh

ZTS: clean up leftover ibackup_trunc files

zfs_receive_raw_incremental did not clean up ibackup_trunc.* files
left over from running the test.

Also changing the path of the ibackup files so they can be placed
in the correct directories when /var/tmp is not the temporary
directory.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: bunder2015 <omfgbunder at gmail.com>
Closes #7430

ZFS on Linux — include/linux blkdev_compat.h

Linux compat 4.16: blk_queue_flag_{set,clear}

The HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY case was overlooked in
the original 10f88c5c commit because blk_queue_write_cache()
was available for the in-kernel builds.

Update the blk_queue_flag_{set,clear} wrappers to call the locked
versions to avoid confusion.  This is safe for all existing callers.

The blk_queue_set_write_cache() function has been updated to use
these wrappers.  This means setting/clearing both QUEUE_FLAG_WC
and QUEUE_FLAG_FUA is no longer atomic but this only done early
in zvol_alloc() prior to any requests so there is no issue.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Kash Pande <kash at tripleback.net>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #7428
Closes #7431
Delta File
+6 -8 include/linux/blkdev_compat.h
+6 -8 1 file

ZFS on Linux — config kernel-fst-mount.m4 kernel-mount-nodev.m4, include/linux vfs_compat.h

Allow mounting datasets more than once

Currently mounting an already mounted zfs dataset results in an
error, whereas it is typically allowed with other filesystems.
This causes some bad interactions with mount namespaces. Take
this sequence for example:

- Create a dataset
- Create a snapshot of the dataset
- Create a clone of the snapshot
- Create a new mount namespace
- Rename the original dataset

The rename results in unmounting and remounting the clone in the
original mount namespace, however the remount fails because the
dataset is still mounted in the new mount namespace. (Note that
this means the mount in the new mount namespace is never being
unmounted, so perhaps the unmount/remount of the clone isn't
actually necessary.)

The problem here is a result of the way mounting is implemented
in the kernel module. Since it is not mounting block devices it
uses mount_nodev() instead of the usual mount_bdev(). However,
mount_nodev() is written for filesystems for which each mount is
a new instance (i.e. a new super block), and zfs should be able

    [15 lines not shown]

ZFS on Linux — . configure.ac, lib/libzfs libzfs_pool.c

Add 'zpool split' coverage to the ZFS Test Suite

This change adds five new tests to the ZTS:

 * zpool_split_cliargs: verify command line options and arguments
 * zpool_split_devices: verify zpool split accepts a device list
 * zpool_split_encryption: verify zpool can split encrypted pools
 * zpool_split_props: verify zpool split can set property values
 * zpool_split_vdevs: verify vdev layout when splitting the pool

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #7409

ZFS on Linux — lib/libefi rdwr_efi.c, lib/libshare libshare.c

Fix calloc(3) arguments order

calloc(3) takes `nelem` (or `nmemb` in glibc) first, and then size of
elements.  No difference expected for having these in reverse order,
however should follow the standard.

http://pubs.opengroup.org/onlinepubs/009695399/functions/calloc.html

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro at osnexus.com>
Closes #7405

ZFS on Linux — module/zfs arc.c

Fix zfs_arc_max minimum tuning

When setting `zfs_arc_max` its minimum value is allowed
to be 64 MiB.  There was an off-by-1 error which can matter
on tiny systems.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Chris Zubrzycki <github at mid-earth.net>
Closes #7417
Delta File
+1 -1 module/zfs/arc.c
+1 -1 1 file

ZFS on Linux — lib/libzfs libzfs_pool.c, tests/runfiles linux.run

Fix zpool set feature@<feature>=disabled

Commit e4010f2 accidentally allows zpool to set pool features to
"disabled"; this should only be allowed at pool creation. This commit
adds additional checks and test coverage to 'zpool set'.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #7402

ZFS on Linux — lib/libzfs libzfs_dataset.c libzfs_util.c, man/man8 zfs.8

OpenZFS 9286 - want refreservation=auto

Authored by: Mike Gerdts <mike.gerdts at joyent.com>
Reviewed by: Allan Jude <allanjude at freebsd.org>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: John Kennedy <john.kennedy at delphix.com>
Reviewed by: Andy Stormont <astormont at racktopsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Approved by: Richard Lowe <richlowe at richlowe.net>
Ported-by: Don Brady <don.brady at delphix.com>

Porting Notes:
* Adopted destroy_dataset in ZTS test cleanup
* Use ksh shebang instead of bash for new tests

OpenZFS-issue: https://www.illumos.org/issues/9286
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/723d0c85
Closes #7387

ZFS on Linux — man/man8 zfs.8

zfs(8): fix dedup omission during mdoc overhaul

The property description has been updated with new algorithms as well.

Reviewed-by: Matt Ahrens <matt at delphix.com>
Reviewed-by: Richard Elling <Richard.Elling at RichardElling.com>
Reviewed-by: loli10K <ezomori.nozomu at gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: DHE <git at dehacked.net>
Closes #7377
Delta File
+30 -0 man/man8/zfs.8
+30 -0 1 file

ZFS on Linux — include/sys dnode.h dmu_impl.h, module/zfs dnode.c dmu_objset.c

Fix race in dnode_check_slots_free()

Currently, dnode_check_slots_free() works by checking dn->dn_type
in the dnode to determine if the dnode is reclaimable. However,
there is a small window of time between dnode_free_sync() in the
first call to dsl_dataset_sync() and when the useraccounting code
is run when the type is set DMU_OT_NONE, but the dnode is not yet
evictable, leading to crashes. This patch adds the ability for
dnodes to track which txg they were last dirtied in and adds a
check for this before performing the reclaim.

This patch also corrects several instances when dn_dirty_link was
treated as a list_node_t when it is technically a multilist_node_t.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7147
Closes #7388

ZFS on Linux — config kernel-blk-queue-flags.m4 kernel.m4, include/linux blkdev_compat.h

Linux compat 4.16: blk_queue_flag_{set,clear}

queue_flag_{set,clear}_unlocked are now private interfaces in
the Linux kernel (https://github.com/torvalds/linux/commit/8a0ac14).
Use blk_queue_flag_{set,clear} interfaces which were introduced as
of https://github.com/torvalds/linux/commit/8814ce8.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Closes #7410

ZFS on Linux — lib/libzfs libzfs_dataset.c

Correct swapped keylocation error messages

This patch corrects a small issue where two error messages
in the code that checks for invalid keylocations were
swapped.

Reviewed by: Matt Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7418
Delta File
+4 -4 lib/libzfs/libzfs_dataset.c
+4 -4 1 file

ZFS on Linux — . META, rpm/generic zfs-kmod.spec.in zfs.spec.in

Tag zfs-0.7.8

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2 at llnl.gov>

ZFS on Linux — include/sys zap_leaf.h, module/zfs zfs_vnops.c zap_micro.c

Revert "Handle zap_add() failures in mixed ... "

This reverts commit cc63068e95ee725cce03b1b7ce50179825a6cda5.

Under certain circumstances this change can result in an ENOSPC
error when adding new files to a directory.  See #7401 for full
details.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Issue #7401
Cloes #7416

ZFS on Linux — include/sys zap_leaf.h, module/zfs zfs_vnops.c zap_micro.c

Revert "Handle zap_add() failures in mixed ... "

This reverts commit cc63068e95ee725cce03b1b7ce50179825a6cda5.

Under certain circumstances this change can result in an ENOSPC
error when adding new files to a directory.  See #7401 for full
details.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Issue #7401
Closes #7416

ZFS on Linux — man/man5 zfs-module-parameters.5, module/zfs dmu_send.c

Fix 'zfs send/recv' hang with 16M blocks

When using 16MB blocks the send/recv queue's aren't quite big
enough.  This change leaves the default 16M queue size which a
good value for most pools.  But it additionally ensures that the
queue sizes are at least twice the allowed zfs_max_recordsize.

Reviewed-by: loli10K <ezomori.nozomu at gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #7365
Closes #7404

ZFS on Linux — tests/test-runner/include Makefile.am logapi.shlib, tests/zfs-tests/include zpool_script.shlib libtest.shlib

Clean up (k)shlib and cfg file shebangs

Most kshlib files are imported by other scripts
and do not have a shebang at the top of their files.
Make all kshlib follow this convention.

Remove shebangs from cfg files as well.

Reviewed-by: loli10K <ezomori.nozomu at gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Close #7406

ZFS on Linux — tests/zfs-tests/tests/functional/cli_root/zpool_online zpool_online_001_pos.ksh

Wait for resilver after online

This test performs a rapid offline/online cycle of each of several
mirror vdevs.  It can run so quickly that there isn't sufficient pool
redundancy to perform an offline.  The solution is to wait until the
pool is resilvered following the online operation.

Also, add a pool sync before the offline operation to help reduce
spurious errors.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tim Chase <tim at chase2k.com>
Issue #6900

ZFS on Linux — contrib/initramfs/scripts Makefile.am, tests/runfiles Makefile.am

Fix "file is executable, but no shebang" warnings

Fedora 28's RPM build checks warn when executable files don't have a
shebang line.  These warnings are caused when we (incorrectly)
include data & config files in the_SCRIPTS automake lines. Files in
_SCRIPTS are marked executable by automake. This patch fixes the
issue by including non-executable scripts in a _DATA line instead.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #7359
Closes #7395

ZFS on Linux — rpm/generic zfs.spec.in

Exclude python scripts from RPM shebang check

The newest Fedora packaging rules print warnings for scripts using the
/usr/bin/python shebang:

    *** WARNING: mangling shebang in /usr/bin/arc_summary.py from
    #!/usr/bin/python to #!/usr/bin/python2. This will become an ERROR,
    fix it manually!

Fedora wants all cross compatible scripts to pick python3.  Since we
don't want our users to have to pick a specific version of python, we
exclude our scripts from the RPM build check.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #7360
Closes #7399
Delta File
+10 -0 rpm/generic/zfs.spec.in
+10 -0 1 file

ZFS on Linux — . configure.ac, cmd/zed Makefile.am

systemd mount generator and tracking ZEDLET

zfs-mount-generator implements the "systemd generator" protocol,
producing systemd.mount units from the cached outputs of zfs list,
during early boot, integrating with systemd.

Each pool has an indpendent cache of the command

  zfs list -H -oname,mountpoint,canmount -tfilesystem -r $pool

which is kept synchronized by the ZEDLET

  history_event-zfs-list-cacher.sh

Datasets not in the cache will be loaded later in the boot process by
zfs-mount.service, including pools without a cache.

Among other things, this allows for complex mount hierarchies.

Reviewed-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Reviewed-by: Richard Laager <rlaager at wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Antonio Russo <antonio.e.russo at gmail.com>
Closes #7329

ZFS on Linux — include/sys spa.h dmu.h, module/zfs spa_misc.c

Fixes for SNPRINTF_BLKPTR with encrypted BP's

mdb doesn't have dmu_ot[], so we need a different mechanism for its
SNPRINTF_BLKPTR() to determine if the BP is encrypted vs authenticated.

Additionally, since it already relies on BP_IS_ENCRYPTED (etc),
SNPRINTF_BLKPTR might as well figure out the "crypt_type" on its own,
rather than making the caller do so.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tom Caputi <tcaputi at datto.com>
Signed-off-by: Matthew Ahrens <mahrens at delphix.com>
Closes #7390
Delta File
+14 -3 include/sys/spa.h
+12 -3 include/sys/dmu.h
+1 -11 module/zfs/spa_misc.c
+27 -17 3 files

ZFS on Linux — module/zfs mmp.c

Fix divide-by-zero in mmp_delay_update()

vdev_count_leaves() in the denominator may return 0, caught by Coverity.
Introduced by

* 533ea04 Update mmp_delay on sync or skipped, failed write

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Olaf Faaland <faaland1 at llnl.gov>
Closes #7391
Delta File
+1 -1 module/zfs/mmp.c
+1 -1 1 file

ZFS on Linux — cmd/zfs zfs_main.c, tests/zfs-tests/tests/functional/cli_root/zfs_mount zfs_mount_encrypted.ksh

Make encrypted "zfs mount -a" failures consistent

Currently, "zfs mount -a" will print a warning and fail to mount
any encrypted datasets that do not have a key loaded. This patch
makes the behavior of this failure consistent with other failure
modes ("zfs mount -a" will silently continue, explict "zfs mount"
will print a message and return an error code.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7382

ZFS on Linux — module/zfs mmp.c spa.c, tests/zfs-tests/tests/functional/mmp mmp.kshlib mmp_active_import.ksh

Update mmp_delay on sync or skipped, failed write

When an MMP write is skipped, or fails, and time since
mts->mmp_last_write is already greater than mts->mmp_delay, increase
mts->mmp_delay.  The original code only updated mts->mmp_delay when a
write succeeded, but this results in the write(s) after delays and
failed write(s) reporting an ub_mmp_delay which is too low.

Update mmp_last_write and mmp_delay if a txg sync was successful.  At
least one uberblock was written, thus extending the time we can be sure
the pool will not be imported by another host.

Do not allow mmp_delay to go below (MSEC2NSEC(zfs_multihost_interval) /
vdev_count_leaves()) so that a period of frequent successful MMP writes,
e.g. due to frequent txg syncs, does not result in an import activity
check so short it is not reliable based on mmp thread writes alone.

Remove unnecessary local variable, start.  We do not use the start time
of the loop iteration.

Add a debug message in spa_activity_check() to allow verification of the
import_delay value and to prove the activity check occurred.

Alter the tests that import pools and attempt to detect an activity
check.  Calculate the expected duration of spa_activity_check() based on

    [10 lines not shown]

ZFS on Linux — cmd/zvol_id zvol_id_main.c, lib/libspl/include umem.h

Fedora 28: Fix misc bounds check compiler warnings

Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #7361
Closes #7368

ZFS on Linux — module/zfs zfs_ioctl.c

Fix spa reference leak in zfs_ioc_pool_scan

zfs_ioc_pool_scan leaks a spa reference when zc->zc_flags is not a
valid pool_scrub_cmd_t: this could happen if the userland binaries
and ZFS kernel module differ in version and would prevent the pool from
being exported.

Reviewed by: Matt Ahrens <matt at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #7380
Delta File
+3 -3 module/zfs/zfs_ioctl.c
+3 -3 1 file

ZFS on Linux — tests/zfs-tests/tests/functional/cli_root/zpool_add add_nested_replacing_spare.ksh

Fix add_nested_replacing_spare test case

Use 'zpool reopen' instead of 'zpool scrub' to kick in the spare device:
this is required to avoid spurious failures caused by a race condition
in events processing by the ZFS Event Daemon:

P1 (zpool scrub)                            P2 (zed)
---
zfs_ioc_pool_scan()
 -> dsl_scan()
  -> vdev_reopen()
   -> vdev_set_state(VDEV_STATE_CANT_OPEN)
                                            zfs_ioc_vdev_attach()
                                             -> spa_vdev_attach()
                                              -> dsl_resilver_restart()
  -> dsl_sync_task()
   -> dsl_scan_setup_check()
   <- dsl_scan_setup_check(): EBUSY

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #7247
Closes #7342

ZFS on Linux — module/zfs arc.c

Remove ASSERT() in l2arc_apply_transforms()

The ASSERT was erroneously copied from the next section of code.
The buffer's size should be expanded from "psize" to "asize"
if necessary.

Reviewed-by: Tom Caputi <tcaputi at datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tim Chase <tim at chase2k.com>
Closes #7375
Delta File
+4 -4 module/zfs/arc.c
+4 -4 1 file

ZFS on Linux — include/sys zio.h spa.h, module/zfs arc.c dbuf.c

Decryption error handling improvements

Currently, the decryption and block authentication code in
the ZIO / ARC layers is a bit inconsistent with regards to
the ereports that are produces and the error codes that are
passed to calling functions. This patch ensures that all of
these errors (which begin as ECKSUM) are converted to EIO
before they leave the ZIO or ARC layer and that ereports
are correctly generated on each decryption / authentication
failure.

In addition, this patch fixes a bug in zio_decrypt() where
ECKSUM never gets written to zio->io_error.

Reviewed by: Matt Ahrens <matt at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7372
Delta File
+30 -4 module/zfs/arc.c
+14 -6 module/zfs/dbuf.c
+5 -4 include/sys/zio.h
+5 -4 module/zfs/zfs_fm.c
+5 -1 module/zfs/dmu_objset.c
+5 -1 module/zfs/dmu_send.c
+4 -3 3 files not shown
+68 -23 9 files

ZFS on Linux — module/zfs dbuf.c

Encrypted dnode blocks should be prefetched raw

Encrypted dnode blocks are always initially read as raw data and
converted to decrypted data when an encrypted bonus buffer is
needed. This allows the DMU to be used for things like fetching
the DMU master node without requiring keys to be loaded. However,
dbuf_issue_final_prefetch() does not currently read the data as
raw. The end result of this is that prefetched dnode blocks are
read twice from disk: once decrypted and then again as raw data.
This patch corrects the issue by adding the flag when appropriate.

Reviewed by: Matt Ahrens <matt at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7362
Delta File
+7 -2 module/zfs/dbuf.c
+7 -2 1 file

ZFS on Linux — include/sys spa_impl.h, module/zfs spa.c dmu_traverse.c

Fix hung z_zvol tasks during 'zfs receive'

During a receive operation zvol_create_minors_impl() can wait
needlessly for the prefetch thread because both share the same tasks
queue.  This results in hung tasks:

<3>INFO: task z_zvol:5541 blocked for more than 120 seconds.
<3>      Tainted: P           O  3.16.0-4-amd64
<3>"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.

The first z_zvol:5541 (zvol_task_cb) is waiting for the long running
traverse_prefetch_thread:260

root at linux:~# cat /proc/spl/taskq
taskq                       act  nthr  spwn  maxt   pri  mina
spl_system_taskq/0            1     2     0    64   100     1
        active: [260]traverse_prefetch_thread [zfs](0xffff88003347ae40)
        wait: 5541
spl_delay_taskq/0             0     1     0     4   100     1
        delay: spa_deadman [zfs](0xffff880039924000)
z_zvol/1                      1     1     0     1   120     1
        active: [5541]zvol_task_cb [zfs](0xffff88001fde6400)
        pend: zvol_task_cb [zfs](0xffff88001fde6800)

This change adds a dedicated, per-pool, prefetch taskq to prevent the

    [9 lines not shown]

ZFS on Linux — etc/init.d zfs-functions.in

zfs-functions: skip lines where mntpnt is 'none'

This fixes zfs-mount initscript trying to mount swap volumes
as filesystems or anything that has 'none' as a mountpoint
in /etc/fstab.  Additionally, fixes trying to mount swap volumes
as a filesystem on RHEL.  RHEL defines mountpoint for swap
as `swap`.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Georgy Yakovlev <ya at sysdump.net>
Closes #7346
Closes #7347
Delta File
+2 -0 etc/init.d/zfs-functions.in
+2 -0 1 file

ZFS on Linux — lib/libzfs libzfs_import.c

Add support for nvme based devids

Adds a devid for nvme devices. This is very similar to how the
other 'bus' (scsi|sata|usb) devids are generated. The devid
resides in a name/value pair in the leaf vdevs in a zpool config.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Richard Elling <Richard.Elling at RichardElling.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Don Brady <don.brady at delphix.com>
Closes #7356
Delta File
+13 -2 lib/libzfs/libzfs_import.c
+13 -2 1 file

ZFS on Linux — module/zfs qat_compress.c gzip.c

Resolve QAT issues with incompressible data

Currently, when ZFS wants to accelerate compression with QAT, it
passes a destination buffer of the same size as the source buffer.
Unfortunately, if the data is incompressible, QAT can actually
"compress" the data to be larger than the source buffer. When this
happens, the QAT driver will return a FAILED error code and print
warnings to dmesg. This patch fixes these issues by providing the
QAT driver with an additional buffer to work with so that even
completely incompressible source data will not cause an overflow.

This patch also resolves an error handling issue where
incompressible data attempts compression twice: once by QAT and
once in software. To fix this issue, a new (and fake) error code
CPA_STATUS_INOMPRESSIBLE has been added so that the calling code
can correctly account for the difference between a hardware
failure and data that simply cannot be compressed.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Weigang Li <weigang.li at intel.com>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7338
Delta File
+90 -34 module/zfs/qat_compress.c
+12 -3 module/zfs/gzip.c
+4 -0 module/zfs/qat.h
+106 -37 3 files

ZFS on Linux — cmd/ztest ztest.c, man/man5 zfs-module-parameters.5

Optimize possible split block search space

Remove duplicate segment copies to minimize the possible search
space for reconstruction.  Once reduced an accurate assessment can
be made regarding the difficulty in reconstructing the block.

Also, ztest will now run zdb with
zfs_reconstruct_indirect_combinations_max set to 1000000 in an attempt
to avoid checksum errors.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Tim Chase <tim at chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #6900

ZFS on Linux — module/zfs dsl_scan.c

Fix ASSERT in dsl_scan_fini() and cleanup comments

This patch fixes an issue where dsl_scan_prefetch_cb() might
add more prefetch I/Os to the prefetch queue after prefetching
has been completed. This was happening because that code was
checking scn->scn_suspending instead of scn->scn_prefetch_stop.
This occasionally triggered an ASSERT during ztest runs in
dsl_scan_fini() when the code attempted to destroy an AVL tree
that still had entires in it. This patch also includes a number
of spelling corrections and comment cleanups throughout
dsl_scan.c

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7353
Delta File
+13 -13 module/zfs/dsl_scan.c
+13 -13 1 file

ZFS on Linux — etc/init.d zfs-import.in zfs-mount.in

chmod -x on etc/init.d/zfs-*.in automake files

Clear executable bit on zfs-import.in, zfs-mount.in,
zfs-share.in, and zfs-zed.in.  These are automake files and
should not be marked executable.  This fixes a RPM build error
on Fedora 28.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #7355
Closes #7327
Delta File
+0 -0 etc/init.d/zfs-import.in
+0 -0 etc/init.d/zfs-mount.in
+0 -0 etc/init.d/zfs-share.in
+0 -0 etc/init.d/zfs-zed.in
+0 -0 4 files

ZFS on Linux — . configure.ac, config user-libaio.m4 zfs-build.m4

Fix mmap / libaio deadlock

Calling uiomove() in mappedread() under the page lock can result
in a deadlock if the user space page needs to be faulted in.

Resolve the issue by dropping the page lock before the uiomove().
The inode range lock protects against concurrent updates via
zfs_read() and zfs_write().

Reviewed-by: Albert Lee <trisk at forkgnu.org>
Reviewed-by: Chunwei Chen <david.chen at nutanix.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #7335
Closes #7339

ZFS on Linux — config user-libattr.m4 user.m4, tests/zfs-tests/cmd/mktree mktree.c

Remove libattr requirement

RHEL/CentOS 6 supports sys/xattr.h eliminating the need for
libattr-devel as a dependency.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: DHE <git at dehacked.net>
Closes #7344
Closes #7351