Displaying 1 50 of 4,358 commits (0.007s)

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

Fix typo in zfs-module-parameters man page

Fix typo in zfs-module-parameters man page

Reviewed-by: Richard Laager <rlaager at wiktel.com>
Reviewed-by: Mike McQuaid <mike at mikemcquaid.com>
Reviewed-by: Paul Dagnelie <pcd at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Gvozden Neskovic <neskovic at gmail.com>
Reviewed-by: Neal Gompa <ngompa13 at gmail.com>
Reviewed-by: Jason Zaman <jason at perfinion.com>
Reviewed-by: Ned Bass <bass6 at llnl.gov>
Reviewed-by: Jorgen Lundman <lundman at lundman.net>
Reviewed-by: Prakash Surya <prakash.surya at delphix.com>
Reviewed-by: Hajo Möller <dasjoe at gmail.com>
Reviewed-by: Igor Kozhukhov <ikozhukhov at gmail.com>
Reviewed-by: Richard Yao <ryao at gentoo.org>
Reviewed-by: Tim Chase <tim at chase2k.com>
Reviewed-by: DHE <git at dehacked.net>
Reviewed-by: Matthew Thode <prometheanfire at gentoo.org>
Reviewed-by: Thomas Caputi <tcaputi at datto.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: kernelOfTruth <kerneloftruth at gmail.com>
Reviewed-by: Kash Pande <kash at tripleback.net>
Reviewed-by: ilovezfs <ilovezfs at icloud.com>

    [8 lines not shown]
Delta File
+1 -1 man/man5/zfs-module-parameters.5
+1 -1 1 file

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

Typo in zfs-module-parameters(5)

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: DHE <git at dehacked.net>
Closes #6061
Delta File
+1 -1 man/man5/zfs-module-parameters.5
+1 -1 1 file

ZFS on Linux — cmd/zpool zpool_main.c

Fix 'zpool iostat -v' cache and log output

Fixes formatting errors from commit d6418de057

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: loli10K <ezomori.nozomu at gmail.com>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: DHE <git at dehacked.net>
Closes #6060
Delta File
+2 -0 cmd/zpool/zpool_main.c
+2 -0 1 file

ZFS on Linux — lib/libzfs libzfs_import.c

Fixed zdb -e regression for active cacheless pools

zdb -e for active cache-less pools fails:

$ sudo zpool create -o cachefile=none basic mirror sdk sdl
$ sudo zdb -e -b basic
zdb: can't open 'basic': No such file or directory

This is a recent regression introduce by commit c30d8de.

Reviewed-by: Richard Yao <ryao at gentoo.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Don Brady <don.brady at intel.com>
Closes #6059
Delta File
+7 -2 lib/libzfs/libzfs_import.c
+7 -2 1 file

ZFS on Linux — module/zfs zfs_vnops.c

Fix lseek result when dnode is dirty

Fixup commit 66aca24.  We should have equivalent return
values as generic_file_llseek() and advance to end of file.

Reviewed-by: Richard Yao <ryao at gentoo.org>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Tested-by: bunder2015 <omfgbunder at gmail.com>
Signed-off-by: Debabrata Banerjee <dbanerje at akamai.com>
Closes #6050
Closes #6053
Delta File
+7 -3 module/zfs/zfs_vnops.c
+7 -3 1 file

ZFS on Linux — cmd/zpool/zpool.d lsblk

Fix shellcheck warning in pre-baked script

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>
Closes #6055
Delta File
+1 -1 cmd/zpool/zpool.d/lsblk
+1 -1 1 file

ZFS on Linux — module/zfs vdev_label.c

Correct lock ASSERTs in vdev_label_read/write

The existing assertions in vdev_label_read() and vdev_label_write(),
testing which config locks are held, are incorrect. The assertions
test for locks which exceed what is required for safety.

Both vdev_label_{read,write}() are changed to assert SCL_STATE is held
as RW_READER or RW_WRITER. This is safe because:

Changes to the vdev tree occur under SCL_ALL as RW_WRITER, via
spa_vdev_enter() and spa_vdev_exit().

Changes to vdev state occur under SCL_STATE_ALL as RW_WRITER, via
spa_vdev_state_enter() and spa_vdev_state_exit().

Therefore, the new assertions guarantee that the vdev cannot change
out from under a zio, and I/O to a specified leaf vdev's label is
safe.

Furthermore, this is consistent with the SPA locking discussion in
spa_misc.c, "For any zio operation that takes an explicit vdev_t
argument ... zio_read_phys(), or zio_write_phys() ... SCL_STATE as
reader suffices."

Reviewed-by: Chunwei Chen <david.chen at osnexus.com>

    [3 lines not shown]
Delta File
+6 -6 module/zfs/vdev_label.c
+6 -6 1 file

ZFS on Linux — . Makefile.am zfs-script-config.sh.in, cmd/zpool zpool_main.c zpool_iter.c

Prebaked scripts for zpool status/iostat -c

This patch updates the "zpool status/iostat -c" commands to only run
"pre-baked" scripts from the /etc/zfs/zpool.d directory (or wherever
you install to).  The scripts can only be run from -c as an unprivileged
user (unless the ZPOOL_SCRIPTS_AS_ROOT environment var is
set by root).  This was done to encourage scripts to be written is such
a way that normal users can use them, and to be cautious.  If your
script needs to run a privileged command, consider adding the
appropriate line in /etc/sudoers.  See zpool(8) for an example of how
to do this.

The patch also allows the scripts to output custom column names.  If
the script outputs a line like:

name=value

then "name" is used for the column name, and "value" is its value.
Multiple columns can be specified by outputting multiple lines.  Column
names and values can have spaces.  If the value is empty, a dash (-) is
printed instead.

After all the "name=value" lines are read (if any), zpool will take the
next the next line of output (if any) and print it without a column
header.  After that, no more lines will be processed. This can be

    [10 lines not shown]

ZFS on Linux — cmd/zfs zfs_main.c, man/man8 zfs.8

Documentation fixes for zfs(8) and 'zfs' binary

* bookmarks are not supported when sending all intermediary snaps (-I)
* add missing compressed (-c) option to the 'zfs' help and manpage

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed by: Richard Laager <rlaager at wiktel.com>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #6028
Delta File
+6 -6 man/man8/zfs.8
+2 -2 cmd/zfs/zfs_main.c
+8 -8 2 files

ZFS on Linux — cmd/vdev_id vdev_id

vdev_id: fix failure due to multipath -l bug

Udev may fail to create the expected symbolic links in
/dev/disk/by-vdev on systems with the
device-mapper-multipath-0.4.9-100.el6 package installed. This affects
RHEL 6.9 and possibly other downstream distributions.

That version of the multipath command may incorrectly list a drive
state as "unkown" instead of "running". The issue was introduced
in the patch for https://bugzilla.redhat.com/show_bug.cgi?id=1401769

The vdev_id udev helper uses the state reported by "multipath -l" to
detect an online component disk of a multipath device in order to
resolve its physical slot and enclosure. Changing the command
invocation to "multipath -ll" works around the above issue by causing
multipath to consult additional sources of information to determine
the drive state.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: Ned Bass <bass6 at llnl.gov>
Closes #6039
Delta File
+2 -2 cmd/vdev_id/vdev_id
+2 -2 1 file

ZFS on Linux — cmd/zfs zfs_main.c

Allow bookmark short name in 'zfs bookmark'

This lets users create a bookmark from the command line by its name
only, without the need to specify the dataset path which is extacted
from the snapshot parameter.

These commands are now equivalent:

   zfs bookmark poolname/fs at snap poolname/fs#bookmark
   zfs bookmark @snap poolname/fs#bookmark
   zfs bookmark poolname/fs at snap \#bookmark

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu at gmail.com>
Closes #3665
Closes #6027
Delta File
+19 -3 cmd/zfs/zfs_main.c
+19 -3 1 file

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

zfs_receive_010_pos: change dd arguments

The  `dd` command as written will not create a hole in the file.
Additionally, the `stride` argument isn't understood by `dd` so
it's replaced with `seek` which isn't equivilant but will result in
a single whole which is sufficient for the test case.  Finally,
`conv=notrunc` is added to avoid truncating the file.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: George Melikov <mail at gmelikov.ru>
Closes #6023

ZFS on Linux — lib/libzfs libzfs_sendrecv.c

Fix leak in send_iterate_fs

Fix a leak when generating a replication stream of a cloned dataset.

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: Tim Crawford <tcrawford at datto.com>
Closes #6034
Delta File
+2 -0 lib/libzfs/libzfs_sendrecv.c
+2 -0 1 file

ZFS on Linux — tests/zfs-tests/tests/functional/cli_root/zpool_scrub zpool_scrub_004_pos.ksh

Clean up correctly in zpool_scrub_004_pos

Ensure `zinject -c` all gets called whenever
zpool_scrub_004_pos exits.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Issue #5444
Closes #6021

ZFS on Linux — tests/zfs-tests/include commands.cfg

zfstest: add dmesg command to $PATH

Error example in `zfs_list_007_pos`:
`sudo: dmesg: command not found`

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: George Melikov <mail at gmelikov.ru>
Closes #6024

ZFS on Linux — module/zfs dsl_pool.c

OpenZFS 8026 - retire zfs_throttle_delay and zfs_throttle_resolution

Authored by: Andriy Gapon <avg at FreeBSD.org>
Approved by: Richard Lowe <richlowe at richlowe.net>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/8026
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/9b33e07
Closes #6014
Delta File
+0 -3 module/zfs/dsl_pool.c
+0 -3 1 file

ZFS on Linux — module/zfs sa.c

OpenZFS 8061 - sa_find_idx_tab can be declared more type-safely

Authored by: Matthew Ahrens <mahrens at delphix.com>
Approved by: Dan McDonald <danmcd at omniti.com>
Reviewed by: George Wilson <george.wilson at delphix.com>
Reviewed by: Chris Williamson <chris.williamson at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

sa_find_idx_tab() is declared as taking and returning "void *" parameters.
These can be declared to be the specific types.

OpenZFS-issue: https://www.illumos.org/issues/8061
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/4e64aff
Closes #6017
Delta File
+5 -6 module/zfs/sa.c
+5 -6 1 file

ZFS on Linux — module/zfs dbuf.c

OpenZFS 8025 - dbuf_read() creates unnecessary zio_root() for bonus buf

Authored by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel at delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov at delphix.com>
Reviewed by: Prashanth Sreenivasa <pks at delphix.com>
Approved by: Robert Mustacchi <rm at joyent.com>
Ported-by: Brian Behlendorf <behlendorf1 at llnl.gov>

dbuf_read() creates a zio_root() to track and wait for all the zio's
that may happen as part of this call. However, if the blkptr_t for
this buffer is NULL or a hole, we will not create any more zio's, so
this zio_root() is unnecessary. This is always the case when calling
dbuf_read() on a bonus buffer, because it has no blkptr (it's part of
the containing dnode). For workloads that read a lot of bonus buffers
(e.g. file creation and removal), creating and destroying these
unnecessary zio's can decrease performance by around 3%.

The fix is to only create/destroy the zio_root() in dbuf_read() if the
blkptr is not NULL and not a hole.

Porting Notes:
- The error handling for when dbuf_read_impl() fails which was
  originally added in commit 5f6d0b6f5 has been preserved.


    [3 lines not shown]
Delta File
+5 -5 module/zfs/dbuf.c
+5 -5 1 file

ZFS on Linux — module/zfs zfs_vfsops.c zfs_ioctl.c

OpenZFS 6101 - attempt to lzc_create() a filesystem under a volume results in a panic

Authored by: Andriy Gapon <avg at FreeBSD.org>
Approved by: Dan McDonald <danmcd at omniti.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

When querying ZPL properties verify that the objset is of type
DMU_OST_ZFS.

OpenZFS-issue: https://www.illumos.org/issues/6101
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ce2243a
Closes #6015

ZFS on Linux — cmd/zdb zdb.c, man/man8 zdb.8

OpenZFS 6392 - zdb: introduce -V for verbatim import

Authored by: Richard Yao <ryao at gentoo.org>
Approved by: Dan McDonald <danmcd at omniti.com>
Reviewed by: Yuri Pankov <yuri.pankov at gmail.com>
Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed by: Matt Ahrens <mahrens at delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov at delphix.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

Porting Notes:
  This was already implemented in ZFS on Linux. This patch
  is to resolved the deltas present in our version.

OpenZFS-issue: https://www.illumos.org/issues/6392
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/9bb97de
Closes #6020

ZFS on Linux — cmd/zdb zdb.c

OpenZFS 7900 - zdb shouldn't print the path of a znode at verbosity < 5

Authored by: Alan Somers <asomers at gmail.com>
Approved by: Dan McDonald <danmcd at omniti.com>
Reviewed by: Paul Dagnelie <pcd at delphix.com>
Reviewed by: Matt Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

There are two reasons:
1) Finding a znode's path is slower than printing any other znode
   information at verbosity < 5.
2) On a corrupted pool like the one mentioned below, zdb will crash when it
   tries to determine the znode's path. But with this patch, zdb can still
   extract useful information from such pools.

OpenZFS-issue: https://www.illumos.org/issues/7900
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/2b0dee1
Closes #6016
Delta File
+8 -12 cmd/zdb/zdb.c
+8 -12 1 file

ZFS on Linux — cmd/zdb zdb.c, man/man8 zdb.8

OpenZFS 6410 - teach zdb to perform object lookups by path

Authored by: Yuri Pankov <yuri.pankov at nexenta.com>
Reviewed by: Pavel Zakharov <pavel.zakharov at delphix.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Will Andrews <will at freebsd.org>
Approved by: Dan McDonald <danmcd at omniti.com>
Ported-by: Brian Behlendorf <behlendorf1 at llnl.gov>

Porting Notes:
- Replaced zdb.8 with upstream mdoc zdb.1m version.  Updated to
  include Linux specific features: -V verbatium imports and
  improved label printing (-u, and -l).
- Minor changes to `zdb -h` output to honor 80 character limit.

OpenZFS-issue: https://www.illumos.org/issues/6410
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ed61ec1
Closes #6006
Delta File
+326 -511 man/man8/zdb.8
+236 -89 cmd/zdb/zdb.c
+562 -600 2 files

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

OpenZFS 5120 - zfs should allow large block/gzip/raidz boot pool (loader project)

Authored by: Toomas Soome <tsoome at me.com>
Reviewed by: George Wilson <george.wilson at delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov at nexenta.com>
Reviewed by: Andrew Stormont <andyjstormont at gmail.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Approved by: Robert Mustacchi <rm at joyent.com>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Don Brady <don.brady at intel.com>
Ported-by: Brian Behlendorf <behlendorf1 at llnl.gov>

Porting Notes:
- grub-2.02-beta2-422-gcad5cc0 includes support for large blocks.
- Commit 8aab121 allowed GZIP[1-9].
- Grub allows pools with multiple top-level vdevs.

OpenZFS-issue: https://www.illumos.org/issues/5120
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c8811bd
Closes #6007

ZFS on Linux — cmd/zpool zpool_main.c

Invalidate cache during a zpool labelclear

Be sure to invalidate a vdev's cache before performing
a zpool labelclear. There are cases where the cache is
stale because we did some operation that bypassed it,
and since we are doing an open with only O_RDWR, we
should invalidate it to be safe.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Closes #6009
Delta File
+4 -0 cmd/zpool/zpool_main.c
+4 -0 1 file

ZFS on Linux — . configure.ac, module/zfs zfs_debug.c

OpenZFS 7503 - zfs-test should tail ::zfs_dbgmsg on test failure

Authored by: Pavel Zakharov <pavel.zakharov at delphix.com>
Reviewed by: John Kennedy <john.kennedy at delphix.com>
Reviewed by: Matt Ahrens <mahrens at delphix.com>
Approved by: Gordon Ross <gordon.w.ross at gmail.com>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Ported-by: Brian Behlendorf <behlendorf1 at llnl.gov>

Porting Notes:
- Enable internal log for DEBUG builds and in zfs-tests.sh.
- callbacks/zfs_dbgmsg.ksh - Dump interal log via kstat.
- callbacks/zfs_dmesg.ksh - Dump dmesg log.
- default.cfg - 'Test Suite Specific Commands' dropped.

OpenZFS-issue: https://www.illumos.org/issues/7503
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/55a1300
Closes #6002

ZFS on Linux — tests/runfiles linux.run, tests/zfs-tests/include default.cfg

OpenZFS 7535 - need test for resumed send of top most filesystem

Authored by: John Kennedy <john.kennedy at delphix.com>
Reviewed by: George Wilson <george.wilson at delphix.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Approved by: Richard Lowe <richlowe at richlowe.net>
Ported-by: Brian Behlendorf <behlendorf1 at llnl.gov>

Porting Notes:
- zfs_share_001_pos.ksh - Older versions of exportfs will match
  multiple exports that share a common prefix.  Reorder the 'fs'
  list so unshares occur from most to least unique.
- zfs_share_005_pos.ksh - Enabled and updated for Linux.

OpenZFS-issue: https://www.illumos.org/issues/7535
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ac89d1e
Closes #5979

ZFS on Linux — module/zfs zfs_fm.c

Skip rate limiting events in zfs_ereport_post

In zfs_ereport_post, if an event is a rate limiting
event, immediately return before any processing is done.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Closes #5998
Delta File
+3 -3 module/zfs/zfs_fm.c
+3 -3 1 file

ZFS on Linux — module/zfs spa_misc.c, tests/runfiles linux.run

Fix size inflation in spa_get_worst_case_asize()

When we try assign a new transaction to a TXG we must know beforehand
if there is sufficient free space on disk. This is to decide,
in dmu_tx_assign(), if we should reject the TX with ENOSPC.

We rely on spa_get_worst_case_asize() to inflate the size of our
logical writes by a factor of spa_asize_inflation which is
calculated as:

   (VDEV_RAIDZ_MAXPARITY + 1) * SPA_DVAS_PER_BP * 2 == 24

The problem with the current implementation is that we don't take
into account what happens with very small writes on VDEVs with large
physical block sizes.
Consider the case of writes to a dataset with recordsize=512,
copies=3 on a VDEV with ashift=13 (usually SSD with 8K block size):
every logical IO will end up allocating 3 * 8K = 24K on disk, so 512
bytes multiplied by 48, which is double the size we account for.
If we allow this kind of writes to be assigned a TX it is possible,
when the pool is almost full, to trigger an allocation failure
(ENOSPC) in the ZIO pipeline, which will in turn result in the whole
pool being suspended.

The bug is fixed by using, in spa_get_worst_case_asize(), the MAX()

    [7 lines not shown]
Delta File
+74 -0 tests/zfs-tests/tests/functional/no_space/enospc_003_pos.ksh
+10 -2 module/zfs/spa_misc.c
+2 -1 tests/zfs-tests/tests/functional/no_space/Makefile.am
+1 -1 tests/runfiles/linux.run
+0 -0 tests/zfs-tests/tests/functional/no_space/enospc_002_pos.ksh
+87 -4 5 files

ZFS on Linux — module/zfs vdev_queue.c

OpenZFS 8005 - poor performance of 1MB writes on certain RAID-Z configurations

Authored by: Matt Ahrens <mahrens at delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov at nexenta.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Don Brady <don.brady at intel.com>
Ported-by: Matt Ahrens <mahrens at delphix.com>

RAID-Z requires that space be allocated in multiples of P+1 sectors,
because this is the minimum size block that can have the required amount
of parity.  Thus blocks on RAIDZ1 must be allocated in a multiple of 2
sectors; on RAIDZ2 multiple of 3; and on RAIDZ3 multiple of 4.  A sector
is a unit of 2^ashift bytes, typically 512B or 4KB.

To satisfy this constraint, the allocation size is rounded up to the
proper multiple, resulting in up to 3 "pad sectors" at the end of some
blocks.  The contents of these pad sectors are not used, so we do not
need to read or write these sectors.  However, some storage hardware
performs much worse (around 1/2 as fast) on mostly-contiguous writes
when there are small gaps of non-overwritten data between the writes.
Therefore, ZFS creates "optional" zio's when writing RAID-Z blocks that
include pad sectors.  If writing a pad sector will fill the gap between
two (required) writes, we will issue the optional zio, thus doubling
performance.  The gap-filling performance improvement was introduced in

    [55 lines not shown]
Delta File
+14 -5 module/zfs/vdev_queue.c
+14 -5 1 file

ZFS on Linux — tests/zfs-tests/tests/functional/cli_root/zfs_snapshot zfs_snapshot_009_pos.ksh, tests/zfs-tests/tests/functional/snapshot snapshot_002_pos.ksh snapshot_006_pos.ksh

zfstest - replace dircmp with diff

`dircmp` doesn't exist in Linux while `diff` is already used
by zfstests on all platforms.

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 #5996

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

zfstest reservation_009_pos.sh missed backslash

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

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

zfs_receive_010_pos.ksh local => typeset change

Ksh uses `typeset`, `local` is a Bash analog.

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 #5995

ZFS on Linux — tests/zfs-tests/tests/functional/cli_user/misc setup.ksh

zfstests cli_user/misc/setup.ksh space missed

Ksh syntax requires a space after `!` in if statement.

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 #5994

ZFS on Linux — lib/libspl timestamp.c

Fix `zpool iostat -T d 1` on musl

When building on Gentoo against musl, GCC complains:

timestamp.c: In function ‘print_timestamp’:
timestamp.c:32:19: warning: passing argument 1 of ‘nl_langinfo’ makes
integer from pointer without a cast
 #define _DATE_FMT "%+"
                   ^
timestamp.c:47:21: note: in expansion of macro ‘_DATE_FMT’
   fmt = nl_langinfo(_DATE_FMT);
                     ^
The error was wrapped to meet comment style requirements.

This code is used by `zpool iostat -T d 1` to print a date and upon
testing it, I see no date printed. Lets use D_T_FMT so that something
gets printed and if D_T_FMT is not avaliable, then we can fall back to
"%+".

Reviewed-by: George Melikov <mail at gmelikov.ru>
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: Richard Yao <ryao at gentoo.org>
Closes #5993
Delta File
+5 -1 lib/libspl/timestamp.c
+5 -1 1 file

ZFS on Linux — cmd/zed zed_log.c

Add missing includes to zed_log.c

GCC 4.9.4 complains about implicit function declarations when building
against musl on Gentoo.

zed_log.c: In function ‘zed_log_pipe_open’:
zed_log.c:69:7: warning: implicit declaration of function ‘getpid’
       (int)getpid());
       ^
zed_log.c:71:2: warning: implicit declaration of function ‘pipe’
  if (pipe(_ctx.pipe_fd) < 0)
  ^
zed_log.c: In function ‘zed_log_pipe_close_reads’:
zed_log.c:90:2: warning: implicit declaration of function ‘close’
  if (close(_ctx.pipe_fd[0]) < 0)
  ^
zed_log.c: In function ‘zed_log_pipe_wait’:
zed_log.c:141:3: warning: implicit declaration of function ‘read’
   n = read(_ctx.pipe_fd[0], &c, sizeof (c));

The [-Wimplicit-function-declaration] at the end of each warning has
been removed to meet comment style requirements.

The man pages say to include <sys/types.h> and <unistd.h>. Doing that
silences the warnings.

    [6 lines not shown]
Delta File
+2 -0 cmd/zed/zed_log.c
+2 -0 1 file

ZFS on Linux — lib/libspl/include/sys poll.h errno.h, lib/libzfs libzfs_util.c

Fix header inclusions for standards conformance

musl's sys/errno.h is literally:

/#warning redirecting incorrect #include <sys/errno.h> to <errno.h>
/#include <errno.h>

It does the same for sys/{poll,signal}.h. This is rather noisy when
building ZoL against musl. musl is also correct in pointing out that the
correct headers are outside of sys/ according to the single unix
specification:

http://pubs.opengroup.org/onlinepubs/7908799/xsh/errno.h.html
http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.h.html
http://pubs.opengroup.org/onlinepubs/7908799/xsh/signal.h.html

Lets implement our own sys/* versions of these headers to redirect to
the proper userland ones when building in userspace. That will silence
the warning.

There are also some instances where we include incorrectly from sys/ or
from outside of sys/ in userspace only code. In these instances, lets
just fix the includes directly.

Reviewed-by: George Melikov <mail at gmelikov.ru>

    [5 lines not shown]

ZFS on Linux — lib/libzfs libzfs_sendrecv.c

OpenZFS 5380 - receive of a send -p stream doesn't need to try renaming snapshots

Authored by: Andriy Gapon <avg at FreeBSD.org>
Approved by: Dan McDonald <danmcd at omniti.com>
Reviewed by: Paul Dagnelie <pcd at delphix.com>
Reviewed by: Matt Ahrens <mahrens at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

recv_incremental_replication() takes care of things like removing
datasets that have been removed on the sending side, detecting renamed
datasets, ensuring that all datasets in the affected hierarchy have the
same properties as their counterparts on the sending side.
All of the above are not necessary if we are receiving a stream for a
single dataset that has been generated with zfs send -p, that is, a
stream that includes properties.  zfs_receive_one() already takes care
of applying the properties to the received datasets.

OpenZFS-issue: https://www.illumos.org/issues/5380
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/b8ab927
Closes #5990
Delta File
+3 -3 lib/libzfs/libzfs_sendrecv.c
+3 -3 1 file

ZFS on Linux — module/zfs dsl_pool.c

OpenZFS 8027 - tighten up dsl_pool_dirty_delta

Authored by: Andriy Gapon <avg at FreeBSD.org>
Approved by: Dan McDonald <danmcd at omniti.com>
Reviewed by: Matt Ahrens <mahrens at delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim at delphix.com>
Reviewed by: Paul Dagnelie <pcd at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/8027
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/642668d
Closes #5988
Delta File
+1 -1 module/zfs/dsl_pool.c
+1 -1 1 file

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

OpenZFS 8023 - Panic destroying a metaslab deferred range tree

Authored by: George Wilson <george.wilson at delphix.com>
Approved by: Dan McDonald <danmcd at omniti.com>
Reviewed by: Brad Lewis <brad.lewis at delphix.com>
Reviewed by: Matt Ahrens <mahrens at delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel at delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov at nexenta.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

We don't want to dirty any data when we're in the final txgs of the pool
export logic. This change introduces checks to make sure that no data is
dirtied after a certain point. It also addresses the culprit of this
specific bug – the space map cannot be upgraded when we're in final
stages of pool export. If we encounter a space map that wants to be
upgraded in this phase, then we simply ignore the request as it will get
retried the next time we set the fragmentation metric on that metaslab.

OpenZFS-issue: https://www.illumos.org/issues/8023
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/2ef00f5
Closes #5991

ZFS on Linux — lib/libzfs libzfs_fru.c

OpenZFS 8046 - Let calloc() do the multiplication in libzfs_fru_refresh

Authored by: Pedro Giffuni <pfg at freebsd.org>
Approved by: Robert Mustacchi <rm at joyent.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Paul Dagnelie <pcd at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/8046
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/3a3c0d5
Closes #5989
Delta File
+1 -1 lib/libzfs/libzfs_fru.c
+1 -1 1 file

ZFS on Linux — tests/zfs-tests/include libtest.shlib, tests/zfs-tests/tests/functional/cli_root/zfs_rollback zfs_rollback_common.kshlib

OpenZFS 7629 - Fix for 7290 neglected to remove some escape sequences

Authored by: John Wren Kennedy <john.kennedy at delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel at delphix.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Approved by: Robert Mustacchi <rm at joyent.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Ported-by: Brian Behlendorf <behlendorf1 at llnl.gov>

Porting Notes:
- Multiple changes in this commit were applied in c1d9abf.

OpenZFS-issue: https://www.illumos.org/issues/7629
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/f5fb56d
Closes #5980

ZFS on Linux — . Makefile.am, scripts zfs-tests.sh

Correct shellcheck make recipe

Consolidated the shellcheck call in the
make recipe down to a single call of
shellcheck. Corrected script errors that
have been skipped. Corrected script errors
that have been introduced because make
wasn't reporting any errors from shellcheck.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Closes #5976
Delta File
+18 -18 scripts/zfs-tests.sh
+4 -8 Makefile.am
+22 -26 2 files

ZFS on Linux — . TEST

Skip xfstests on Amazon Linux

The ZFS enabled versions of xfstests fails to build cleanly on
Amazon Linux.  This issue should be resolved by rebasing the ZFS
patches against the latest xfstests and pushing those patches
upstream.  This would allow us to use an unmodified xfstests.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Issue #5481
Closes #5977
Delta File
+2 -0 TEST
+2 -0 1 file

ZFS on Linux — cmd/zed/agents zfs_mod.c

Fix coverity defects: CID 161288

CID 161288:  Null pointer dereferences  (REVERSE_INULL)

Ensure physpath != NULL before the strcmp.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Closes #5974
Delta File
+1 -1 cmd/zed/agents/zfs_mod.c
+1 -1 1 file

ZFS on Linux — include zfeature_common.h, man/man5 zpool-features.5

OpenZFS 2932 - support crash dumps to raidz, etc. pools

Authored by: Bill Pijewski <wdp at joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek at joyent.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Approved by: Dan McDonald <danmcd at nexenta.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/2932
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/810e43b
Closes #5984
Closes #5216

ZFS on Linux — . configure.ac .gitignore, config user-commands.m4 user.m4

OpenZFS 7290 - ZFS test suite needs to control what utilities it can run

Authored by: John Wren Kennedy <john.kennedy at delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel at delphix.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Dan McDonald <danmcd at omniti.com>
Approved by: Gordon Ross <gordon.w.ross at gmail.com>
Ported-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Ported-by: George Melikov <mail at gmelikov.ru>

Porting Notes:
- Utilities which aren't available under Linux have been removed.
- Because of sudo's default secure path behavior PATH must be
  explicitly reset at the top of libtest.shlib.  This avoids the
  need for all users to customize secure path on their system.
- Updated ZoL infrastructure to manage constrained path
- Updated all test cases
- Check permissions for usergroup tests
- When testing in-tree create links under bin/
- Update fault cleanup such that missing files during
  cleanup aren't fatal.
- Configure su environment with constrained path

OpenZFS-issue: https://www.illumos.org/issues/7290
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/1d32ba6
Closes #5903

ZFS on Linux — cmd/zpool zpool_vdev.c

Accept raidz and mirror with similar redundancy

Allow a pool to be created with both raidz and mirror members,
without giving -f, as long as they have matching redundancy.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Haakan T Johansson <f96hajo at chalmers.se>
Closes #5915
Delta File
+43 -1 cmd/zpool/zpool_vdev.c
+43 -1 1 file

ZFS on Linux — module/zfs zfs_fm.c

Fix regression in zfs_ereport_start()

On 32-bit platforms spa_state is 32 bits without cast, and thus
caused a NULL pointer dereference when treated as 64bit in
var arg.  Accidentally introduced by bcdb96a.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark at intel.com>
Signed-off-by: Don Brady <don.brady at intel.com>
Closes #5966
Closes #5965
Delta File
+3 -2 module/zfs/zfs_fm.c
+3 -2 1 file

ZFS on Linux — cmd/zed zed_event.c

Fix coverity defects: CID 161264

CID 161264:  Uninitialized variables  (UNINIT)

In _zed_event_add_nvpair, when handling DATA_TYPE_UINT64,
we should be using i64 throughout the entire case.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Don Brady <don.brady at intel.com>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Closes #5964
Delta File
+1 -1 cmd/zed/zed_event.c
+1 -1 1 file

ZFS on Linux — man/man8 zpool.8, tests/zfs-tests/tests/functional/cli_user/zpool_list zpool_list_001_pos.ksh

list -o props should be alloc,free not used,avail

Manpage suggests the zpool list properties include 'used'
and 'available', when these are invalid property names.
Use alloc and free in their place.

```
$ zpool list -o name,size,used   2>&1 |head -1
bad property list: invalid property 'used'
$ zpool list -o name,size,avail   2>&1 |head -1
bad property list: invalid property 'avail'
$ zpool list -o name,size,available   2>&1 |head -1
bad property list: invalid property 'available'
$ zpool list -o name,size,alloc,free
NAME    SIZE  ALLOC   FREE
apool   464M   203M   261M
bpool  3.62T  1.97T  1.65T
```

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: loli10K <ezomori.nozomu at gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Matthews <tom at axiom-partners.com>
Closes #5959