Displaying 1 50 of 5,421 commits (0.007s)

ZFS on Linux — . META

Tag 0.8.0-rc2

Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Delta File
+2 -2 META
+2 -2 1 file

ZFS on Linux — contrib/dracut/90zfs parse-zfs.sh.in

Allow spaces in pool names for cmdline argument

PR #8114 quoted the ${ENCRYPTIONROOT} parameter to ensure we don't
lose spaces when unlocking root filesystem in the off chance that
it has a space in its name.

Unfortunately, dracut and initramfs-tools do not actually get the
quotes from the cmdline. If we use root=ZFS="root pool/filesystem
name" the script still only sees root=ZFS=root and no quotation
marks.

Because + is a reserved character in ZFS, it's used as a
placeholder for spaces in the kernel cmdline.  In this way,
root=ZFS=root+pool/filesystem+name will properly expand by
replacing the character with sed (POSIX compliant method).

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: bunder2015 <omfgbunder at gmail.com>
Signed-off-by: Kash Pande <kash at tripleback.net>
Issue #8114
Closes #8117

ZFS on Linux — module/zfs vdev_label.c

Fix coverity defects: CID 184285

CID 184285: Read from pointer after free (USE_AFTER_FREE)

This patch fixes an use-after-free in vdev_config_generate_stats()
moving the kmem_free() call at the end of the function.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <guss80 at gmail.com>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #8120
Delta File
+1 -2 module/zfs/vdev_label.c
+1 -2 1 file

ZFS on Linux — config user-systemd.m4, rpm/generic zfs.spec.in zfs-dkms.spec.in

Fix systemd spec file macros

Ensure that the _unitdir, _presetdir, _modulesloaddir, and
_systemdgeneratordir macros are always defined.  If not set
them to the expected default values.  Pass all of these options
to ./configure and package the resulting files in those locations.

Additionally, set __brp_mangle_shebangs_exclude_from until the
conversion to Python 3 is complete so they may be built cleanly
under mock.

Reviewed-by: Neal Gompa <ngompa at datto.com>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #7567
Closes #8119

ZFS on Linux — contrib/initramfs/scripts zfs.in

Make initramfs-tools script encryption aware

Changed decrypt_fs zfs command to "load-key"
Plymouth case code based on "contrib/dracut/90zfs/zfs-lib.sh.in"
Systemd case based on "contrib/dracut/90zfs/zfs-load-key.sh.in"
Cleaned up misspelling of "available" throughout

Code style fixes
Single quote for ${ENCRYPTIONROOT}
Changed "${DECRYPT_CMD}"  to "eval ${DECRYPT_CMD}"

Reviewed-by: Kash Pande <kash at tripleback.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tom Caputi <tcaputi at datto.com>
Reviewed-by: Richard Laager <rlaager at wiktel.com>
Signed-off-by: Garrett Fields <ghfields at gmail.com>
Closes #8093
Delta File
+34 -64 contrib/initramfs/scripts/zfs.in
+34 -64 1 file

ZFS on Linux — contrib/dracut/90zfs mount-zfs.sh.in

Add quotations for ${ENCRYPTIONROOT}

Add quotations for ${ENCRYPTIONROOT} to avoid breaking systems
with a space in the name.

Reviewed-by: bunder2015 <omfgbunder at gmail.com>
Reviewed-by: Tom Caputi <tcaputi at datto.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Kash Pande <kash at tripleback.net>
Related-to: #8093
Closes #8114

ZFS on Linux — cmd/zpool zpool_main.c, include/sys zio.h spa.h

Add zpool status -s (slow I/Os) and -p (parseable)

This patch adds a new slow I/Os (-s) column to zpool status to show the
number of VDEV slow I/Os. This is the number of I/Os that didn't
complete in zio_slow_io_ms milliseconds. It also adds a new parsable
(-p) flag to display exact values.

         NAME         STATE     READ WRITE CKSUM  SLOW
         testpool     ONLINE       0     0     0     -
          mirror-0   ONLINE       0     0     0     -
             loop0    ONLINE       0     0     0    20
             loop1    ONLINE       0     0     0     0

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #7756
Closes #6885

ZFS on Linux — module/zfs zfs_ctldir.c, tests/zfs-tests/tests/functional/delegate delegate_common.kshlib setup.ksh

Update zfs_admin_snapshot value (disabled)

It's disabled by default, update code and tests to reflect
the documentation.

Minor cleanup in delegate_common.kshlib.

Reviewed-by: Gregor Kopka <gregor at kopka.net>
Reviewed-by: John Kennedy <john.kennedy at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: George Melikov <mail at gmelikov.ru>
Closes #7835
Closes #8045

ZFS on Linux — tests/test-runner/bin zts-report.py, tests/zfs-tests/tests/functional/cli_root/zfs_rename zfs_rename_009_neg.ksh zfs_rename_006_pos.ksh

ZTS: Fix and reenable zfs_rename tests

zfs_rename_006_pos has been flaky in the past because it was
missing a call to block_device_wait to ensure the zvols it creates
are present before running dd. Whenever this this happened,
zfs_rename_009_neg would also fail because the first test would
leak a zvol clone that it did not know how to clean up. This patch
fixes the root cause and reenables the test. It also fixes some
minor grammar errors.

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

ZFS on Linux — tests/test-runner/bin zts-report.py, tests/zfs-tests/tests/functional/cli_root/zfs_mount zfs_mount_006_pos.ksh

ZTS: Fix test zfs_mount_006_pos

For Linux, place a file in the mount point folder so it will be
considered "busy".  Fix the while loop so it doesn't rm in
directories above the testdir.  Add Linux-specific code to test
overlay on|off.

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

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

Add BuildRequires gcc, make, elfutils-libelf-devel

This adds a BuildRequires for gcc, make, and elfutils-libelf-devel
into our spec files.  gcc has been a packaging requirement for
awhile now:

https://fedoraproject.org/wiki/Packaging:C_and_C%2B%2B

These additional BuildRequires allow us to mock build in
Fedora 29.

Reviewed-by: Neal Gompa <ngompa at datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by:  Tony Hutter <hutter2 at llnl.gov>
Closes #8095
Closes #8102

ZFS on Linux — cmd/ztest ztest.c

Fix !zilog_is_dirty() assert during ztest

ztest occasionally hits an assert that !zilog_is_dirty() during
zil_close(). This is caused by an interaction between 2 threads.
First, ztest_run() waits for each test thread to complete and
closes the associated dataset as soon as the thread joins. At
the same time, the ztest_vdev_add_remove() test may attempt to
remove the slog, which will open, dirty, and reset the logs on
every dataset in the pool (including those of other threads).
This patch simply ensures that we always join all of the test
threads before closing any datasets.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8094
Delta File
+9 -3 cmd/ztest/ztest.c
+9 -3 1 file

ZFS on Linux — module/zfs vdev_indirect.c

Fix divide by zero during indirect split damage

This patch simply ensures that vdev_indirect_splits_damage()
cannot hit a divide by zero exception if a split has no
children with valid data. The normal reconstruction code
path in vdev_indirect_reconstruct_io_done() already has this
check.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8086
Delta File
+8 -1 module/zfs/vdev_indirect.c
+8 -1 1 file

ZFS on Linux — module/zfs vdev.c

Fix dirtying vdev config on with RO spa

This patch simply corrects an issue where vdev_dtl_reassess()
could attempt to dirty the vdev config even when the spa was
not elligable for writing.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8085
Delta File
+3 -2 module/zfs/vdev.c
+3 -2 1 file

ZFS on Linux — cmd/ztest ztest.c, module/zfs dsl_crypt.c

Replay logs before starting ztest workers

This patch ensures that logs are replayed on all datasets prior
to starting ztest workers. This ensures that the call to
vdev_offline() a log device in ztest_fault_inject() will not fail
due to the log device being required for replay.

This patch also fixes a small issue found during testing where
spa_keystore_load_wkey() does not check that the dataset specified
is an encryption root. This check was present in libzfs, however.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8084
Delta File
+68 -11 cmd/ztest/ztest.c
+9 -2 module/zfs/dsl_crypt.c
+77 -13 2 files

ZFS on Linux — module/zfs vdev_removal.c

Fix vdev removal finishing race

This patch fixes a race condition where the end of
vdev_remove_replace_with_indirect(), which holds
svr_lock, would race against spa_vdev_removal_destroy(),
which destroys the same lock and is called asynchronously
via dsl_sync_task_nowait().

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Issue #6900
Closes #8083
Delta File
+6 -9 module/zfs/vdev_removal.c
+6 -9 1 file

ZFS on Linux — module/zfs vdev.c

Make vdev_set_deferred_resilver() recursive

vdev_clear() can call vdev_set_deferred_resilver() with a
non-leaf vdev to setup a deferred resilver. However, this
function is currently written to only handle leaf vdevs.
This bug was introduced with deferred resilvers in 80a91e74.
This patch makes this function recursive so that it can find
appropriate vdevs to resilver and set vdev_resilver_deferred
on them.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Issue #7732
Closes #8082
Delta File
+8 -1 module/zfs/vdev.c
+8 -1 1 file

ZFS on Linux — include libzutil.h, lib/libzutil zutil_import.c

Fix libudev dependency in libzutil

ZFS should be able to build without libudev installed. The recent
change for libzutil inadvertently broke that.  Make the libudev code
conditional in zutil_import.c to resolve the build failure.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Don Brady <don.brady at delphix.com>
Closes #8097

ZFS on Linux — lib/libzfs libzfs_pool.c

zpool: bogus error for invalid dedupditto value

When provided with an invalid 'dedupditto' value zpool prints
a misleading error message:

    $ sudo zpool set dedupditto=99 pp
    cannot set property for 'pp': property 'dedupditto'(14) not defined

Fix this by printing a meaningful error description for unsupported
'dedupditto' values.

Reviewed-by: Olaf Faaland <faaland1 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #8079
Delta File
+15 -3 lib/libzfs/libzfs_pool.c
+15 -3 1 file

ZFS on Linux — cmd/ztest ztest.c, module/zfs metaslab.c

ztest: reduce gangblock creation

In order to validate the gang block code ztest is configured to
artificially force a fraction of large blocks to be written as
gang blocks.  The default setting chosen for this was to
write 25% of all blocks 32k or larger using gang blocks.

The confluence of an unrealistically large number of gang blocks,
the aggressive fault injection done by ztest, and the split
segment reconstruction logic introduced by device removal has
resulted in the following type of failure:

  zdb -bccsv -G -d ... exit code 3

Specifically, zdb was unable to open the pool because it was
unable to reconstruct a damaged block.  Manual investigation
of multiple failures clearly showed that the block could be
reconstructed.  However, due to the large number of damaged
segments (>35) it could not be done in the allotted time.

Furthermore, the large number of gang blocks was determined
to be the reason for the unrealistically large number of
damaged segments.  In order to make this situation less
likely, this change both increases the forced gang block

    [6 lines not shown]
Delta File
+5 -2 module/zfs/metaslab.c
+1 -1 cmd/ztest/ztest.c
+6 -3 2 files

ZFS on Linux — . configure.ac, cmd/mount_zfs mount_zfs.c

Add libzutil for libzfs or libzpool consumers

Adds a libzutil for utility functions that are common to libzfs and
libzpool consumers (most of what was in libzfs_import.c).  This
removes the need for utilities to link against both libzpool and
libzfs.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Don Brady <don.brady at delphix.com>
Closes #8050
Delta File
+2,389 -0 lib/libzutil/zutil_import.c
+76 -2,301 lib/libzfs/libzfs_import.c
+625 -0 lib/libzutil/zutil_device_path.c
+1 -402 lib/libzfs/libzfs_pool.c
+1 -334 lib/libzfs/libzfs_util.c
+157 -0 lib/libzutil/zutil_nicenum.c
+535 -418 33 files not shown
+3,784 -3,455 39 files

ZFS on Linux — man/man5 zfs-events.5

Update zfs-events.5 with info from PSARC 2009/497

Update zfs-events.5 with info from PSARC 2009/497 regarding ereport fields.
Also updates ZIO_STAGE_* and ZIO_FLAG_* descriptions to match current source.

Reviewed by: loli10K <ezomori.nozomu at gmail.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Richard Elling <Richard.Elling at RichardElling.com>
Closes #8057
Delta File
+89 -53 man/man5/zfs-events.5
+89 -53 1 file

ZFS on Linux — tests/test-runner/bin zts-report.py, tests/zfs-tests/tests/functional/acl/posix posix_001_pos.ksh posix_002_pos.ksh

ZTS: Fix posix ACL tests that should pass

Make sure tests have proper include files.  Make sure underlying
"chmod" style permissions don't interfere with ACLs.

Reviewed-by: John Kennedy <john.kennedy at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski at datto.com>
Closes #8069

ZFS on Linux — tests/zfs-tests/callbacks zfs_mmp.ksh, tests/zfs-tests/include libtest.shlib

ZTS: change `$(cat)` to `$(<)` for speedup

It's better to use ksh/bash built in methods,
rather than spawn new processes every time.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: John Wren Kennedy <john.kennedy at delphix.com>
Signed-off-by: George Melikov <mail at gmelikov.ru>
Closes #8071

ZFS on Linux — module/zfs bpobj.c

bpobj_enqueue_subobj() should copy small subobj's

When we delete a snapshot, we consolidate some bpobj's together because
we no longer need to keep their entries in separate buckets.  This is
done in constant time by including the "sub" bpobj by reference in the
parent bpobj.

After many snapshots have been deleted, we may have many sub-bpobj's.
Usually, most sub-bpobj's don't contain many BP's.  Compared to this
small payload, the sub-bpobj is relatively heavyweight since it is a
object in the MOS.  A common scenario on a long-lived pool is for the
vast majority of MOS objects to be small sub-bpobj's.

To improve this situation, when consolidating bpobj's together,
bpobj_enqueue_subobj() can copy the contents of small bpobj's into the
parent, and then delete the enqueued bpobj, rather than including it by
reference.  Since this copying is limited in size (to one block), the
consolidation is still constant time, though with a larger constant due
to reading in the one block of the enqueued bpobj.

This idea and mechanism are similar to how we handle "sub-subobj's".
When including a sub-bpobj by reference, if the sub-bpobj itself has
less than a block of sub-sub-bpobj's, the list of sub-sub-bpobj's is
copied to the parent bpobj's list of sub-bpobj's.


    [6 lines not shown]
Delta File
+176 -40 module/zfs/bpobj.c
+176 -40 1 file

ZFS on Linux — include/spl/sys time.h

Linux 4.20 compat: current_kernel_time()

Commit torvalds/linux at 976516404 removed the current_kernel_time()
function (and several others).  All callers are expected to use
current_kernel_time64().  Update the gethrestime_sec() wrapper
accordingly.

Reviewed-by: Olaf Faaland <faaland1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #8074
Delta File
+5 -2 include/spl/sys/time.h
+5 -2 1 file

ZFS on Linux — lib/libzfs libzfs_dataset.c

Improve snapshot listing error message

Provide a hint in the error message if listing snapshots for a
single dataset fails.

Using -r is not needed to list all snapshots so requiring it when
listing snapshots for a single dataset makes it confusing. This
change will make the error message more clear.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Md Islam <mdnahian at outlook.com>
Closes #8047
Delta File
+4 -2 lib/libzfs/libzfs_dataset.c
+4 -2 1 file

ZFS on Linux — cmd/zdb zdb.c, tests/zfs-tests/tests/functional/pool_checkpoint checkpoint_zdb.ksh pool_checkpoint.kshlib

zdb -k does not work on Linux when used with -e

This minor bug was introduced with the port of the feature from
OpenZFS to ZoL. This patch fixes the issue that was caused by
a minor re-ordering from the original code.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Tim Chase <tim at chase2k.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Serapheim Dimitropoulos <serapheim at delphix.com>
Closes #8001

ZFS on Linux — cmd/arcstat arcstat.py

Added column definitions to arcstat.py

grow: ARC Grow enabled (!arc_no_grow)
free: ARC Free memory (arc_sys_free)
need: ARC Reclaim need (arc_need_free)

Fixed alignment issues (mread had wrong width).

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <guss80 at gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Gregor Kopka <gregor at kopka.net>
Closes #8058
Delta File
+8 -1 cmd/arcstat/arcstat.py
+8 -1 1 file

ZFS on Linux — cmd/zed/agents zfs_mod.c, tests/zfs-tests/tests/functional/fault auto_replace_001_pos.ksh fault.cfg

ZTS: Fix auto_replace_001_pos test

The root cause of these failures is that udev can notify the
ZED of newly created partition before its links are created.
Handle this by allowing an auto-replace to briefly wait until
udev confirms the links exist.

Distill this test case down to its essentials so it can be run
reliably.  What we need to check is that:

  1) A new disk, in the same physical location, is automatically
     brought online when added to the system,
  2) It completes the replacement process, and
  3) The pool is now ONLINE and healthy.

There is no need to remove the scsi_debug module.  After exporting
the pool the disk can be zeroed, removed, and then re-added to the
system as a new disk.

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

ZFS on Linux — cmd/arcstat arcstat.py, tests/test-runner/bin zts-report.py

Fix flake8 "invalid escape sequence 'x'" warning

From, https://lintlyci.github.io/Flake8Rules/rules/W605.html

As of Python 3.6, a backslash-character pair that is not a valid
escape sequence now generates a DeprecationWarning. Although this
will eventually become a SyntaxError, that will not be for several
Python releases.

Note 'float_pobj' was simply removed from arcstat.py since it
was entirely unused.

Reviewed-by: John Kennedy <john.kennedy at delphix.com>
Reviewed-by: Richard Elling <Richard.Elling at RichardElling.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #8056

ZFS on Linux — include zfs_gitrev.h

Remove zfs_gitrev.h

This generated file was accidentally included in previous commit,
80a91e7, and should not be included in the repository.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed by: Don Brady <don.brady at delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #8054
Delta File
+0 -1 include/zfs_gitrev.h
+0 -1 1 file

ZFS on Linux — contrib/initramfs/scripts zfs.in

Allow use of pool GUID as root pool

It's helpful if there are pools with same names,
but you need to use only one of them.

Main case is twin servers, meanwhile some software
requires the same name of pools (e.g. Proxmox).

Reviewed-by: Kash Pande <kash at tripleback.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Igor ‘guardian’ Lidin of Moscow, Russia
Closes #8052
Delta File
+10 -1 contrib/initramfs/scripts/zfs.in
+10 -1 1 file

ZFS on Linux — tests/zfs-tests/tests/functional/projectquota projectid_001_pos.ksh projecttree_001_pos.ksh

ZTS: Update project quota tests

e2fsprogs v1.44.1, which provides lsattr, added a new attribute
for ext3 called "verity".  It is reported after the project quota
flag as a 'V' character in the `lsattr` output.

Update projectid_001_pos.ksh and projecttree_001_pos.ksh to use
a pattern which will match the expected output in both cases.

Reviewed-by: John Kennedy <john.kennedy at delphix.com>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #8043

ZFS on Linux — module/zfs dsl_scan.c

Fix 2 small bugs with cached dsl_scan_phys_t

This patch corrects 2 small bugs where scn->scn_phys_cached was
not properly updated to match the primary copy when it needed to
be. The first resulted in the pause state not being properly
updated and the second resulted in the cached version being
completely zeroed even if the primary was not.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Serapheim Dimitropoulos <serapheim.dimitro at delphix.com>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8010
Delta File
+4 -1 module/zfs/dsl_scan.c
+4 -1 1 file

ZFS on Linux — scripts make_gitrev.sh

Make gitrev more reliable

In some build methods, the gitrev is unnecessarily set to "unknown".
We can improve this by changing the gitrev to use
`git describe --always --long --dirty`.

This gets the revision even when no tag matches (--always).  It prints
the hash even when it exactly matches a tag (--long).  And if there are
uncommitted changes, it appends "-dirty", rather than failing (--dirty).

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed by: Pavel Zakharov <pavel.zakharov at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matthew Thode <prometheanfire at gentoo.org>
Signed-off-by: Matthew Ahrens <mahrens at delphix.com>
Closes #8034
Delta File
+1 -3 scripts/make_gitrev.sh
+1 -3 1 file

ZFS on Linux — cmd/ztest ztest.c

Fix waiting in ztest_device_removal()

spa->spa_vdev_removal is created in a sync task that is initiated
via dsl_sync_task_nowait(). Since the task may not run before
spa_vdev_remove() returns, we must wait at least 1 txg to ensure
that the removal struct has been created.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Serapheim Dimitropoulos <serapheim.dimitro at delphix.com>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8010
Delta File
+9 -0 cmd/ztest/ztest.c
+9 -0 1 file

ZFS on Linux — module/zfs metaslab.c

Fix ENXIO from spa_ld_verify_logs() in ztest

This patch fixes a small issue where the zil_check_log_chain()
code path would hit an EBUSY error. This would occur when
2 threads attempted to call metaslab_activate() at the same time.
In this case, the "loser" would receive an error code which should
have been ignored, but was instead floated to the caller. This
ended up resulting in an ENXIO being returned from from
spa_ld_verify_logs().

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Serapheim Dimitropoulos <serapheim.dimitro at delphix.com>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8010
Delta File
+9 -3 module/zfs/metaslab.c
+9 -3 1 file

ZFS on Linux — . configure.ac, cmd/zpool zpool_main.c

Defer new resilvers until the current one ends

Currently, if a resilver is triggered for any reason while an
existing one is running, zfs will immediately restart the existing
resilver from the beginning to include the new drive. This causes
problems for system administrators when a drive fails while another
is already resilvering. In this case, the optimal thing to do to
reduce risk of data loss is to wait for the current resilver to end
before immediately replacing the second failed drive, which allows
the system to operate with two incomplete drives for the minimum
amount of time.

This patch introduces the resilver_defer feature that essentially
does this for the admin without forcing them to wait and monitor
the resilver manually. The change requires an on-disk feature
since we must mark drives that are part of a deferred resilver in
the vdev config to ensure that we do not assume they are done
resilvering when an existing resilver completes.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: John Kennedy <john.kennedy at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: @mmaybee
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7732

ZFS on Linux — cmd/ztest ztest.c, module/zfs vdev_indirect.c

Fix ztest deadman panic with indirect vdev damage

This patch fixes an issue where ztest's deadman thread would
trigger a panic because reconstructing artifically damaged
blocks would take too long to reconstruct. This patch simply
limits how often ztest inflicts split-block damage and how
many segments it can damage when it does.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Serapheim Dimitropoulos <serapheim.dimitro at delphix.com>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8010

ZFS on Linux — include/sys vdev_impl.h

OpenZFS 9862 - fix typo in comment in vdev_impl.h

Authored by: Allan Jude <allanjude at freebsd.org>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed by: Tony Hutter <hutter2 at llnl.gov>
Approved by: Robert Mustacchi <rm at joyent.com>
Ported-by: George Melikov <mail at gmelikov.ru>

OpenZFS-issue: https://www.illumos.org/issues/9862
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/84927f52
Closes #8036
Delta File
+1 -1 include/sys/vdev_impl.h
+1 -1 1 file

ZFS on Linux — module/zfs dsl_scan.c

Fix issue with scanning dedup blocks as scan ends

This patch fixes an issue discovered by ztest where
dsl_scan_ddt_entry() could add I/Os to the dsl scan queues
between when the scan had finished all required work and
when the scan was marked as complete. This caused the scan
to spin indefinitely without ending.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Serapheim Dimitropoulos <serapheim.dimitro at delphix.com>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8010
Delta File
+16 -0 module/zfs/dsl_scan.c
+16 -0 1 file

ZFS on Linux — . copy-builtin, scripts make_gitrev.sh

Allow copy-builtin to work with modified sources

`scripts/make_gitrev.sh` had 'set -e' so if any command failed it would
fail and cause copy-builtin to fail (copy-builtin also has `set -e`.
This commit also simplifies scripts/make_gitrev.sh to always write a
file by using a cleanup function.  It also simplifies other areas of
the script as well (making it much shorter).

Reviewed-by: John Kennedy <john.kennedy at delphix.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Thode <mthode at mthode.org>
Closes #8022
Closes #8025
Delta File
+13 -24 scripts/make_gitrev.sh
+1 -1 copy-builtin
+14 -25 2 files

ZFS on Linux — cmd/zpool zpool_vdev.c, tests/runfiles linux.run

zpool: allow sharing of spare device among pools

ZFS allows, by default, sharing of spare devices among different pools;
this commit simply restores this functionality for disk devices and
adds an additional tests case to the ZFS Test Suite to prevent future
regression.

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

ZFS on Linux — include/sys zfs_znode.h, module/zfs zfs_ioctl.c zfs_znode.c

Linux does not HAVE_SMB_SHARE

Since Linux does not have an in-kernel SMB server, we don't need the
code to manage it.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Richard Elling <Richard.Elling at RichardElling.com>
Signed-off-by: Matthew Ahrens <mahrens at delphix.com>
Closes #8032

ZFS on Linux — . Makefile.am, module/zfs zfs_dir.c zfs_vnops.c

Linux does not HAVE_DNLC

Since Linux does not have the Directory Name Lookup Cache, we don't need
the code to manage it.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tim Chase <tim at chase2k.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Richard Elling <Richard.Elling at RichardElling.com>
Signed-off-by: Matthew Ahrens <mahrens at delphix.com>
Closes #8031
Delta File
+0 -37 module/zfs/zfs_dir.c
+0 -28 module/zfs/zfs_vnops.c
+1 -1 Makefile.am
+1 -66 3 files

ZFS on Linux — .github PULL_REQUEST_TEMPLATE.md ISSUE_TEMPLATE.md

Advise users to retain issue/PR templates

Occasionally we get issues and PRs from users who delete the
templates.  Advise users that their issues and PRs may be closed if
they do not fill out the templates as we really need this information.

Also updating PR template to drop unneeded approval toggle as we are
now using issue labels for status tracking.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: bunder2015 <omfgbunder at gmail.com>
Closes #8029

ZFS on Linux — module/zfs txg.c

Fix lock inversion in txg_sync_thread()

This patch fixes a lock inversion issue in txg_sync_thread() where
the code would attempt hold the spa config lock as a reader while
holding tx->tx_sync_lock. This races with spa_vdev_remove() which
attempts to hold the tx->tx_sync_lock to assign a new tx (via
spa_history_log_internal()) while holding the spa config lock as a
writer.

Reviewed-by: Serapheim Dimitropoulos <serapheim.dimitro at delphix.com>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Co-authored-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #8010
Delta File
+2 -2 module/zfs/txg.c
+2 -2 1 file

ZFS on Linux — cmd/zdb zdb.c, include zfeature_common.h

Add types to featureflags in zfs

The boolean featureflags in use thus far in ZFS are extremely useful,
but because they take advantage of the zap layer, more interesting data
than just a true/false value can be stored in a featureflag. In redacted
send/receive, this is used to store the list of redaction snapshots for
a redacted dataset.

This change adds the ability for ZFS to store types other than a boolean
in a featureflag. The only other implemented type is a uint64_t array.
It also modifies the interfaces around dataset features to accomodate
the new capabilities, and adds a few new functions to increase
encapsulation.

This functionality will be used by the Redacted Send/Receive feature.

Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Paul Dagnelie <pcd at delphix.com>
Closes #7981

ZFS on Linux — include/spl/sys uio.h, include/sys uio_impl.h

deadlock between mm_sem and tx assign in zfs_write() and page fault

The bug time sequence:
1. thread #1, `zfs_write` assign a txg "n".
2. In a same process, thread #2, mmap page fault (which means the
   `mm_sem` is hold) occurred, `zfs_dirty_inode` open a txg failed,
   and wait previous txg "n" completed.
3. thread #1 call `uiomove` to write, however page fault is occurred
   in `uiomove`, which means it need `mm_sem`, but `mm_sem` is hold by
   thread #2, so it stuck and can't complete,  then txg "n" will
   not complete.

So thread #1 and thread #2 are deadlocked.

Reviewed-by: Chunwei Chen <tuxoko at gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: Grady Wong <grady.w at xtaotech.com>
Closes #7939