]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years ago7504 kmem_reap hangs spa_sync and administrative tasks
Josh Paetzel [Fri, 17 Feb 2017 15:00:13 +0000 (15:00 +0000)]
7504 kmem_reap hangs spa_sync and administrative tasks

illumos/illumos-gate@405a5a0f5c3ab36cb76559467d1a62ba648bd809
https://github.com/illumos/illumos-gate/commit/405a5a0f5c3ab36cb76559467d1a62ba648bd80

https://www.illumos.org/issues/7504

  We see long spa_sync(). We are waiting to hold dp_config_rwlock for writer. Some
  other thread holds dp_config_rwlock for reader, then calls arc_get_data_buf(),
  which finds that arc_is_overflowing()==B_TRUE. So it waits (while holding
  dp_config_rwlock for reader) for arc_reclaim_thread to signal arc_reclaim_waiters_cv.
  Before signaling, arc_reclaim_thread does arc_kmem_reap_now(), which takes ~seconds.

Author: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>

7 years ago7500 Simplify dbuf_free_range by removing dn_unlisted_l0_blkid
Josh Paetzel [Thu, 16 Feb 2017 01:44:56 +0000 (01:44 +0000)]
7500 Simplify dbuf_free_range by removing dn_unlisted_l0_blkid

illumos/illumos-gate@653af1b809998570c7e89fe7a0d3f90992bf0216
https://github.com/illumos/illumos-gate/commit/653af1b809998570c7e89fe7a0d3f90992bf0216

https://www.illumos.org/issues/7500
  With the integration of:

    commit 0f6d88aded0d165f5954688a9b13bac76c38da84
    Author: Alex Reece <alex@delphix.com>
    Date:   Sat Jul 26 13:40:04 2014 -0800
    4873 zvol unmap calls can take a very long time for larger datasets

  the dnode's dn_bufs field was changed from a list to a tree. As a result,
  the dn_unlisted_l0_blkid field is no longer necessary.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>

7 years ago6569 large file delete can starve out write ops
Josh Paetzel [Thu, 19 Jan 2017 20:44:29 +0000 (20:44 +0000)]
6569 large file delete can starve out write ops

illumos/illumos-gate@ff5177ee8bf9a355131ce2cc61ae2da6a5a6fdd6
https://github.com/illumos/illumos-gate/commit/ff5177ee8bf9a355131ce2cc61ae2da6a5a6fdd6

https://www.illumos.org/issues/6569
  The core issue I've found is that there is no throttle for how many
  deletes get assigned to one TXG. As a results when deleting large files
  we end up filling consecutive TXGs with deletes/frees, then write
  throttling other (more important) ops.

  There is an easy test case for this problem. Try deleting several
  large files (at least 1/2 TB) while you do write ops on the same
  pool. What we've seen is performance of these write ops (let's
  call it sideload I/O) would drop to zero.

  More specifically the problem is that dmu_free_long_range_impl()
  can/will fill up all of the dirty data in the pool "instantly",
  before many of the sideload ops can get in. So sideload
  performance will be impacted until all the files are freed.

  The solution we have tested at Nexenta (with positive results)
  creates a relatively simple throttle for how many "free" ops we let
  into one TXG.

  However this solution exposes other problems that should also be
  addressed. If we are to slow down freeing of data that means one
  has to wait even longer (assuming vnode ref count of 1) to get shell
  back after an rm or for NFS thread to finish the free-ing op.
  To avoid this the proposed solution is to call zfs_inactive() async
  for "large" files. Async freeing then begs for the reclaimed space
  to be accounted for in the zpool's "freeing" prop.

  The other issue with having a longer delete is the inability to
  export/unmount for a longer period of time. The proposed solution
  is to interrupt freeing of blocks when a fs is unmounted.

Author: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>

7 years ago3821 Race in rollback, zil close, and zil flush
Andriy Gapon [Mon, 28 Nov 2016 15:09:58 +0000 (15:09 +0000)]
3821 Race in rollback, zil close, and zil flush

illumos/illumos-gate@43297f973a3543e7403ac27076490ab958a94b15
https://github.com/illumos/illumos-gate/commit/43297f973a3543e7403ac27076490ab958a94b15

https://www.illumos.org/issues/3821
  We recently had nodes with some of the latest zfs bits panic on us in a
  rollback-heavy environment. The following is from my preliminary analysis:
  Let's look at where we died:
  > $C
  ffffff01ea6b9a10 taskq_dispatch+0x3a(0, fffffffff7d20450ffffff5551dea920, 1)
  ffffff01ea6b9a60 zil_clean+0xce(ffffff4b7106c080, 7e0f1)
  ffffff01ea6b9aa0 dsl_pool_sync_done+0x47(ffffff4313065680, 7e0f1)
  ffffff01ea6b9b70 spa_sync+0x55f(ffffff4310c1d040, 7e0f1)
  ffffff01ea6b9c20 txg_sync_thread+0x20f(ffffff4313065680)
  ffffff01ea6b9c30 thread_start+8()
  If we dig in we can find that this dataset corresponds to a zone:
  > ffffff4b7106c080::print zilog_t zl_os->os_dsl_dataset->ds_dir->dd_myname
  zl_os->os_dsl_dataset->ds_dir->dd_myname = [ "8ffce16a-13c2-4efa-a233-
  9e378e89877b" ]
  Okay so we have a null taskq pointer. That only happens during the calls to
  zil_open and zil_close. If we poke around we can see that we're actually in
  midst of a rollback:
  > ::pgrep zfs | ::printf "0x%x %s\\n" proc_t . p_user.u_psargs
  0xffffff43262800a0 zfs rollback zones/15714eb6-f5ea-469f-ac6d-
  4b8ab06213c2@marlin_init
  0xffffff54e22a1028 zfs rollback zones/8ffce16a-13c2-4efa-a233-
  9e378e89877b@marlin_init
  0xffffff4362f3a058 zfs rollback zones/0ddb8e49-ca7e-42e1-8fdc-
  4ac4ba8fe9f8@marlin_init
  0xffffff5748e8d020 zfs rollback zones/426357b5-832d-4430-953e-
  10cd45ff8e9f@marlin_init
  0xffffff436b867008 zfs rollback zones/8f36bf37-8a9c-4a44-995c-
  6d1b2751e6f5@marlin_init
  0xffffff4381ad4090 zfs rollback zones/6c8eca18-fbd6-46dd-ac24-
  2ed45cd0da70@marlin_init

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: George Wilson <george.wilson@delphix.com>

7 years ago7181 race between zfs_mount and zfs_ioc_rollback
Andriy Gapon [Tue, 22 Nov 2016 11:51:55 +0000 (11:51 +0000)]
7181 race between zfs_mount and zfs_ioc_rollback

illumos/illumos-gate@90f2c094b3822f4825f21cef2c2faf7d03b55139
https://github.com/illumos/illumos-gate/commit/90f2c094b3822f4825f21cef2c2faf7d03b55139

https://www.illumos.org/issues/7181
  zfsvfs_setup() is called in both zfs_mount and zfs_resume_fs paths.
  dmu_objset_set_user(zfsvfs->z_os, zfsvfs) is called early in zfsvfs_setup()
  before the setup is actually completed,
  thus an under-constructed zfsvfs becomes visible.
  Additionally, there is nothing to serialize the two call paths. As a result two
  threads can step on each other's toes.
  assertion failed: zilog->zl_clean_taskq == NULL, file:
  ../../common/fs/zfs/zil.c, line: 1772

  > $c
  vpanic()
  0xfffffffffbdf6928()
  zil_open+0x45(ffffff1bbc5dd000fffffffff7993880)
  zfsvfs_setup+0x84(ffffffb378d77000, 0)
  zfs_resume_fs+0x132(ffffffb378d77000ffffffb37ddcf000)
  zfs_ioc_rollback+0x96(ffffffb37ddcf000ffffff01dcdc4cd0ffffff01aa091000)
  zfsdev_ioctl+0x215(10a00000000, 5a19, 80465f8, 100003, ffffff01ab318368,
  ffffff0004b59e58)
  cdev_ioctl+0x39(10a00000000, 5a19, 80465f8, 100003, ffffff01ab318368,
  ffffff0004b59e58)
  spec_ioctl+0x60(ffffff0197737700, 5a19, 80465f8, 100003,
  ffffff01ab318368ffffff0004b59e58)
  fop_ioctl+0x55(ffffff0197737700, 5a19, 80465f8, 100003,
  ffffff01ab318368ffffff0004b59e58)
  ioctl+0x9b(7, 5a19, 80465f8)
  sys_syscall32+0x1f7()

  > ffffff1bbc5dd000::print objset_t os_zil
  os_zil = 0xffffff1c053cf7c0
  > 0xffffff1c053cf7c0::print zilog_t zl_clean_taskq

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago6428 set canmount=off on unmounted filesystem tries to unmount children
Andriy Gapon [Tue, 22 Nov 2016 11:50:52 +0000 (11:50 +0000)]
6428 set canmount=off on unmounted filesystem tries to unmount children

illumos/illumos-gate@c079fa4d202eff15e318131c52755d214ffa2da7
https://github.com/illumos/illumos-gate/commit/c079fa4d202eff15e318131c52755d214ffa2da7

https://www.illumos.org/issues/6428
  Scenario:
  $ zfs create rpool/p
  $ zfs set canmount=noauto rpool/p
  $ zfs umount rpool/p
  $ zfs create rpool/p/c
  $ zfs get -r mounted,canmount rpool/p
  NAME             PROPERTY  VALUE     SOURCE
  rpool/p    mounted   no        -
  rpool/p    canmount  noauto    local
  rpool/p/c  mounted   yes       -
  rpool/p/c  canmount  on        default
  In another shell ensure that rpool/p/c is in use, for example:
  $ cd /rpool/p/c
  Then:
  $ zfs set canmount=off rpool/p
  cannot unmount '/rpool/p/c': Device busy
  But there is no reason to try to unmount rpool/p/c in this scenario.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago7199, 7200 dsl_dataset_rollback_sync may try to free already free blocks
Andriy Gapon [Tue, 22 Nov 2016 11:49:55 +0000 (11:49 +0000)]
7199, 7200 dsl_dataset_rollback_sync may try to free already free blocks

7199 dsl_dataset_rollback_sync may try to free already free blocks
7200 no blocks must be born in a txg after a snaphot is created

illumos/illumos-gate@bfaed0b91e57062c38bc16b4f89db3c8f0052a9b
https://github.com/illumos/illumos-gate/commit/bfaed0b91e57062c38bc16b4f89db3c8f0052a9b

https://www.illumos.org/issues/7199
  dsl_dataset_rollback_sync may try to free already freed blocks when it calls
  dsl_destroy_head_sync_impl to destroy a temporary clone.
  That happens if a snapshot to which we are rolling back and from which the
  clone is created has some ZIL records.

https://www.illumos.org/issues/7200
  No new blocks must be born in a dataset in the same TXG after a snapshot of the
  dataset is taken.
  Those blocks would have the same blk_birth as the dataset's ds_prev_snap_txg
  and as such they would be presumed to belong o the snapshot while in fact they
  do not.
  All the datasets must be clean before sync tasks are run, so the described
  scenario may happen only if one of the sync tasks dirties the dataset and
  another sync task takes its snapshot.
  Then, there will be another sync pass because of the dirty data and the new
  blocks will be born in the same TXG when the data is written out.
  It seems that almost all of the existing sync tasks modify only MOS and do not
  dirty any objsets.
  The only exception that I've been able to identify so far is the rollback which
  can modify an objset when it zeroes out the objset's ZIL.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago7180 potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename
Andriy Gapon [Tue, 22 Nov 2016 11:47:27 +0000 (11:47 +0000)]
7180 potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename

illumos/illumos-gate@690041b9caf801816f2d0bac90bc7cecefb73523
https://github.com/illumos/illumos-gate/commit/690041b9caf801816f2d0bac90bc7cecefb73523

https://www.illumos.org/issues/7180
  If a filesystem is not unmounted while the rename is being performed, then, for
  example, a concurrect zfs rollback may call zfs_suspend_fs followed by
  zfs_resume_fs on the same filesystem.
  The latter takes the filesystem's name as an argument. If the filesystem name
  changes as a result of the rename, then dmu_objset_hold(osname, zfsvfs, &os)
  call in zfs_resume_fs would fail resulting in a kernel panic.
  So far I have been able to reproduce this problem on FreeBSD where zfs rename
  has -u option that skips the unmounting before doing the renaming.
  But I think that in theory the same problem can occur on illumos as well,
  because the unmounting is done in userland before invoking the rename ioctl and
  there could be a race with, e.g., zfs mount.
  panic: solaris assert: dmu_objset_hold(osname, zfsvfs, &zfsvfs->z_os) == 0 (0x2
  == 0x0), file: /usr/devel/svn/head/sys/cddl/contrib/opensolaris/uts/common/fs/
  zfs/zfs_vfsops.c, line: 2210
  KDB: stack backtrace:
  db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004df30710
  vpanic() at vpanic+0x182/frame 0xfffffe004df30790
  panic() at panic+0x43/frame 0xfffffe004df307f0
  assfail3() at assfail3+0x2c/frame 0xfffffe004df30810
  zfs_resume_fs() at zfs_resume_fs+0xb9/frame 0xfffffe004df30860
  zfs_ioc_rollback() at zfs_ioc_rollback+0x61/frame 0xfffffe004df308a0
  zfsdev_ioctl() at zfsdev_ioctl+0x65c/frame 0xfffffe004df30940
  devfs_ioctl_f() at devfs_ioctl_f+0x156/frame 0xfffffe004df309a0
  kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe004df30a00
  sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe004df30ae0
  amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe004df30bf0
  Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe004df30bf0

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago6412 zfs receive: -u can be ignored sometimes
Andriy Gapon [Tue, 22 Nov 2016 11:46:22 +0000 (11:46 +0000)]
6412 zfs receive: -u can be ignored sometimes

illumos/illumos-gate@9185393f2919d8b897f6142d8a9fa0429c285dc1
https://github.com/illumos/illumos-gate/commit/9185393f2919d8b897f6142d8a9fa0429c285dc1

https://www.illumos.org/issues/6412
  It seems that zfs receive -F -u would mount a received filesystem after
  receiving a full stream if a destination filesystem already existed (and, thus,
  got destroyed and re-created) and was mounted.
  How to reproduce:
  $ zfs create rpool/sandbox
  $ zfs create rpool/sandbox/from
  $ zfs create rpool/sandbox/to
  $ zfs snap rpool/sandbox/from@snap
  $ zfs send rpool/sandbox/from@snap | zfs recv -v -F -u rpool/sandbox/to
  receiving full stream of rpool/sandbox/from@snap into rpool/sandbox/to@snap
  received 41.7KB stream in 1 seconds (41.7KB/sec)
  $ zfs get mounted rpool/sandbox/to
  NAME                  PROPERTY  VALUE    SOURCE
  rpool/tmp/sandbox/to  mounted   yes      -
  This behavior can be problematic if the mountpoint property changes either
  because it had a non-inherited value or the stream contains properties because
  it has been generated with either -R or -p.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago5778 nvpair_type_is_array() does not recognize DATA_TYPE_INT8_ARRAY
Andriy Gapon [Wed, 2 Nov 2016 17:34:33 +0000 (17:34 +0000)]
5778 nvpair_type_is_array() does not recognize DATA_TYPE_INT8_ARRAY

illumos/illumos-gate@bf4d553b8a4685dc5ba4549cc9ba6d94e9306a81
https://github.com/illumos/illumos-gate/commit/bf4d553b8a4685dc5ba4549cc9ba6d94e9306a81

https://www.illumos.org/issues/5778
  DATA_TYPE_INT8_ARRAY is missing from the array check in nvpair_type_is_array()

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Andriy Gapon <avg@icyb.net.ua>

7 years ago5752 dump_nvlist() is not aware of boolean array
Andriy Gapon [Wed, 2 Nov 2016 17:33:22 +0000 (17:33 +0000)]
5752 dump_nvlist() is not aware of boolean array

illumos/illumos-gate@ee3c499ad1e4fc884a11b2bc6490787b788bf84a
https://github.com/illumos/illumos-gate/commit/ee3c499ad1e4fc884a11b2bc6490787b788bf84a

https://www.illumos.org/issues/5752
  dump_nvlist() is not aware of the boolean array value type:
  bad config type 24 for "foobar"

Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

7 years ago6051 lzc_receive: allow the caller to read the begin record
Andriy Gapon [Wed, 2 Nov 2016 17:32:31 +0000 (17:32 +0000)]
6051 lzc_receive: allow the caller to read the begin record

illumos/illumos-gate@620f322510b2d6433f7f6af60fa52380c07756ad
https://github.com/illumos/illumos-gate/commit/620f322510b2d6433f7f6af60fa52380c07756ad

https://www.illumos.org/issues/6051
  Currently lzc_receive() requires that its snapname argument is a snapshot name
  (contains '').
  @zfs receive allows to specify just a dataset name and would try to deduce the
  snapshot name from the stream.
  I propose to allow lzc_receive() to do the same.
  That seems to be quite easy to implement, it requires only a small amount of
  logic, it does not require any additional system calls or any additional data
  from the stream.
  The benefit is that the new behavior would allow to keep the snapshot names the
  same between the sender and receiver at zero cost, without a need to pass the
  names out of band.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Andriy Gapon <avg@icyb.net.ua>

7 years ago3746 ZRLs are racy
Andriy Gapon [Thu, 27 Oct 2016 07:11:31 +0000 (07:11 +0000)]
3746 ZRLs are racy

illumos/illumos-gate@260af64db74a52d64de8c6c5f67dd0a71d228ca5
https://github.com/illumos/illumos-gate/commit/260af64db74a52d64de8c6c5f67dd0a71d228ca5

https://www.illumos.org/issues/3746
  From the original change log:
  It was possible for a reference to be added even with the lock held, and
  for references added just after a lock release to be lost.
  This bug was also independently found and reported in wesunsolve.net
  issues 6985013 6995524.
  In zrl_add(), always use an atomic operation to update the refcount.
  The mutex in the ZRL only guarantees that wakeups occur for waiters on the
  lock. It offers no protection against concurrent updates of the refcount.
  The only refcount transition that is safe to perform without an atomic
  operation is from ZRL_LOCKED back to 0, since this can only be performed
  by the thread which has the ZRL locked.

Authored by: Will Andrews <will@freebsd.org>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Reviewed by: Pavel Zakharov <pavel.zakha@gmail.com>
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Reviewed by: Justin T. Gibbs <gibbs@scsiguy.com>
Approved by: Matt Ahrens <mahrens@delphix.com>
Author: Youzhong Yang <yyang@mathworks.com>

7 years ago7301 zpool export -f should be able to interrupt file freeing
Alexander Motin [Fri, 14 Oct 2016 11:49:36 +0000 (11:49 +0000)]
7301 zpool export -f should be able to interrupt file freeing

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Author: Alek Pinchuk <alek@nexenta.com>

Closes #175

7 years ago6988 spa_sync() spends half its time in dmu_objset_do_userquota_updates
Alexander Motin [Fri, 14 Oct 2016 11:46:17 +0000 (11:46 +0000)]
6988 spa_sync() spends half its time in dmu_objset_do_userquota_updates

Using a benchmark which creates 2 million files in one TXG, I observe
that the thread running spa_sync() is on CPU almost the entire time we
are syncing, and therefore can be a performance bottleneck. About 50% of
the time in spa_sync() is in dmu_objset_do_userquota_updates().

The problem is that dmu_objset_do_userquota_updates() calls
zap_increment_int(DMU_USERUSED_OBJECT) once for every file that was
modified (or created). In this benchmark, all the files are owned by the
same user/group, so all 2 million calls to zap_increment_int() are
modifying the same entry in the zap. The same issue exists for the
DMU_GROUPUSED_OBJECT.

We should keep an in-memory map from user to space delta while we are
syncing, and when we finish, iterate over the in-memory map and modify
the ZAP once per entry. This reduces the number of calls to
zap_increment_int() from "number of objects modified" to "number of
owners/groups of modified files".

This reduced the time spent in spa_sync() in the file create benchmark
by ~33%, from 11 seconds to 7 seconds.

Closes #107

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Ned Bass <bass6@llnl.gov>
Reviewed by: Jinshan Xiong <jinshan.xiong@intel.com>
Author: Matthew Ahrens <mahrens@delphix.com>

openzfs/openzfs@5fc46359c569369d87728ca09f8705cdff6cc8e2

7 years ago5120 zfs should allow large block/gzip/raidz boot pool (loader project)
Alexander Motin [Fri, 14 Oct 2016 11:41:06 +0000 (11:41 +0000)]
5120 zfs should allow large block/gzip/raidz boot pool (loader project)

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Toomas Soome <tsoome@me.com>

openzfs/openzfs@c8811bd3e2427dddbac6c05a59cfe117d8fea370

7 years ago7402 Create tunable to ignore hole_birth feature
Alexander Motin [Wed, 28 Sep 2016 23:46:08 +0000 (23:46 +0000)]
7402 Create tunable to ignore hole_birth feature

Until we can resolve the numerous hole_birth bugs that have cropped up
recently, and come up with a way going forwards to protect users from
corruption, we should disable the hole_birth feature.  Using a tunable
allows those who are confident that their data is correct to continue to
take advantage of the feature.

Closes #188

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Author: Paul Dagnelie <pcd@delphix.com>

7 years ago7254 ztest failed assertion in ztest_dataset_dirobj_verify: dirobjs + 1 == usedobjs
Alexander Motin [Wed, 28 Sep 2016 23:44:13 +0000 (23:44 +0000)]
7254 ztest failed assertion in ztest_dataset_dirobj_verify: dirobjs + 1 == usedobjs

dsl_dataset_space is looking at the ds_bp's fill count while
dmu_objset_write_ready() is concurrently modifying it. This fix adds an
rrwlock to protect the ds_bp.

Closes #180

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Author: Paul Dagnelie <pcd@delphix.com>

7 years ago7259 DS_FIELD_LARGE_BLOCKS is unused
Alexander Motin [Wed, 7 Sep 2016 20:07:39 +0000 (20:07 +0000)]
7259 DS_FIELD_LARGE_BLOCKS is unused

The DS_FIELD_LARGE_BLOCKS macro has been unused since the integration of
this patch:

    commit ca0cc3918a1789fa839194af2a9245f801a06b1a
    Author: Matthew Ahrens <mahrens@delphix.com>
    Date:   Fri Jul 24 09:53:55 2015 -0700

        5959 clean up per-dataset feature count code
        Reviewed by: Toomas Soome <tsoome@me.com>
        Reviewed by: George Wilson <george@delphix.com>
        Reviewed by: Alex Reece <alex@delphix.com>
        Approved by: Richard Lowe <richlowe@richlowe.net>

This patch simply removes this macro from dsl_dataset.h.

Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago7278 tuning zfs_arc_max does not impact arc_c_min
Alexander Motin [Wed, 7 Sep 2016 20:00:22 +0000 (20:00 +0000)]
7278 tuning zfs_arc_max does not impact arc_c_min

When changing zfs_arc_max (e.g. as zdb does), it may be set to less
than the default arc_c_min. arc_c_min should decrease to not be more than
arc_c_max, but it doesn't; therefore tuning of arc_c_max is ineffective.

Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Author: Matthew Ahrens <mahrens@delphix.com>

openzfs/openzfs@608764beadaf4bb71c5d8fe1818e8392ac66a61b

7 years ago7004 dmu_tx_hold_zap() does dnode_hold() 7x on same object
Alexander Motin [Sat, 3 Sep 2016 10:54:56 +0000 (10:54 +0000)]
7004 dmu_tx_hold_zap() does dnode_hold() 7x on same object

Using a benchmark which has 32 threads creating 2 million files in the
same directory, on a machine with 16 CPU cores, I observed poor
performance. I noticed that dmu_tx_hold_zap() was using about 30% of
all CPU, and doing dnode_hold() 7 times on the same object (the ZAP
object that is being held).

dmu_tx_hold_zap() keeps a hold on the dnode_t the entire time it is
running, in dmu_tx_hold_t:txh_dnode, so it would be nice to use the
dnode_t that we already have in hand, rather than repeatedly calling
dnode_hold(). To do this, we need to pass the dnode_t down through
all the intermediate calls that dmu_tx_hold_zap() makes, making these
routines take the dnode_t* rather than an objset_t* and a uint64_t
object number. In particular, the following routines will need to have
analogous *_by_dnode() variants created:

dmu_buf_hold_noread()
dmu_buf_hold()
zap_lookup()
zap_lookup_norm()
zap_count_write()
zap_lockdir()
zap_count_write()

This can improve performance on the benchmark described above by 100%,
from 30,000 file creations per second to 60,000. (This improvement is on
top of that provided by working around the object allocation issue. Peak
performance of ~90,000 creations per second was observed with 8 CPUs;
adding CPUs past that decreased performance due to lock contention.) The
CPU used by dmu_tx_hold_zap() was reduced by 88%, from 340 CPU-seconds
to 40 CPU-seconds.

Sponsored by: Intel Corp.

Closes #109

Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Ned Bass <bass6@llnl.gov>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Author: Matthew Ahrens <mahrens@delphix.com>

openzfs/openzfs@d3e523d489a169ab36f9ec1b2a111a60a5563a9f

7 years ago7247 zfs receive of deduplicated stream fails
Alexander Motin [Sat, 3 Sep 2016 10:50:43 +0000 (10:50 +0000)]
7247 zfs receive of deduplicated stream fails

This resolves two 'zfs recv' issues. First, when receiving into an
existing filesystem, a snapshot created during the receive process is
not added to the guid->dataset map for the stream, resulting in failed
lookups for deduped streams when a WRITE_BYREF record refers to a
snapshot received earlier in the stream. Second, the newly created
snapshot was also not set properly, referencing the snapshot before the
new receiving dataset rather than the existing filesystem.

Closes #159

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Author: Chris Williamson <chris.williamson@delphix.com>

openzfs/openzfs@b09697c8c18be68abfe538de9809938239402ae8

7 years ago7003 zap_lockdir() should tag hold
Alexander Motin [Sat, 3 Sep 2016 10:48:48 +0000 (10:48 +0000)]
7003 zap_lockdir() should tag hold

zap_lockdir() / zap_unlockdir() should take a "void *tag" argument which
tags the hold on the zap. This will help diagnose programming errors
which misuse the hold on the ZAP.

Sponsored by: Intel Corp.

Closes #108

Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Author: Matthew Ahrens <mahrens@delphix.com>

openzfs/openzfs@0780b3eab5a2c13e04328b39ecd2a6d0d3c4f7cb

7 years ago7297 clear() on llquantize aggregation causes dtrace to exit
Mark Johnston [Fri, 26 Aug 2016 20:51:09 +0000 (20:51 +0000)]
7297 clear() on llquantize aggregation causes dtrace to exit
7298 printa() of multiple aggregations can fail for llquantize()

illumos/illumos-gate@0ddc0ebb74cedb0ac394818c6e166c47eb8e62e5

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Adam Leventhal <adam.leventhal@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

7 years ago7277 zdb should be able to print zfs_dbgmsg's
Andriy Gapon [Mon, 15 Aug 2016 14:24:47 +0000 (14:24 +0000)]
7277 zdb should be able to print zfs_dbgmsg's

illumos/illumos-gate@29bdd2f916366ece37c4748bca6b3d61f57a223b
https://github.com/illumos/illumos-gate/commit/29bdd2f916366ece37c4748bca6b3d61f57a223b

https://www.illumos.org/issues/7277
  ztest always prints the debug messages (zfs_dbgmsg()) by calling
  zfs_dbgmsg_print(). We should add a flag to zdb to make it do this as well
  before exiting.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Pavel Zakharov <pavel.zakharov@delphix.com>

7 years ago7136 ESC_VDEV_REMOVE_AUX ought to always include vdev information
Andriy Gapon [Mon, 15 Aug 2016 14:23:50 +0000 (14:23 +0000)]
7136 ESC_VDEV_REMOVE_AUX ought to always include vdev information

7115 6922 generates ESC_ZFS_VDEV_REMOVE_AUX a bit too often

illumos/illumos-gate@b72b6bb10ad55121a1b352c6f68ebdc8e20c9086
https://github.com/illumos/illumos-gate/commit/b72b6bb10ad55121a1b352c6f68ebdc8e20c9086

https://www.illumos.org/issues/7136
  6922 added ESC_ZFS_VDEV_REMOVE_AUX and ESC_ZFS_VDEV_REMOVE_DEV sysevents
  whenever an aux device gets removed from a pool. However, those sysevents will
  be created without the vdev_guid and vdev_path fields. It would be better to
  always populate those fields.

https://www.illumos.org/issues/7115
  The addition of spa_event_notify in vdev removal code (see #6922) causes events
  to be generated even if the spare failed to be removed with EBUSY.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Alan Somers <asomers@gmail.com>

7 years ago7230 add assertions to dmu_send_impl() to verify that stream includes BEGIN and END...
Andriy Gapon [Mon, 15 Aug 2016 14:22:12 +0000 (14:22 +0000)]
7230 add assertions to dmu_send_impl() to verify that stream includes BEGIN and END records

illumos/illumos-gate@12b90ee2d3b10689fc45f4930d2392f5fe1d9cfa
https://github.com/illumos/illumos-gate/commit/12b90ee2d3b10689fc45f4930d2392f5fe1d9cfa

https://www.illumos.org/issues/7230
  A test failure occurred where a send stream had only a BEGIN record. This
  should not be possible if the send returns without error. Prevented this from
  happening in the future by adding an assertion to dmu_send_impl() to verify
  that if the function returns 0 (success) both a BEGIN and END record are
  present. Did this by adding flags to dmu_sendarg_t (indicating whether BEGIN or
  END records sent), having dump_record() set flags appropriately, adding VERIFY
  statement to dmu_send_impl().

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matt Krantz <matt.krantz@delphix.com>

7 years ago7235 remove unused func dsl_dataset_set_blkptr
Andriy Gapon [Mon, 15 Aug 2016 14:21:46 +0000 (14:21 +0000)]
7235 remove unused func dsl_dataset_set_blkptr

illumos/illumos-gate@bd56f80007857b960e0981ed0797ad8ec844a96b
https://github.com/illumos/illumos-gate/commit/bd56f80007857b960e0981ed0797ad8ec844a96b

https://www.illumos.org/issues/7235
  The function dsl_dataset_set_blkptr() is unused. We should remove it.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago7090 zfs should improve allocation order and throttle allocations
Andriy Gapon [Mon, 15 Aug 2016 14:21:10 +0000 (14:21 +0000)]
7090 zfs should improve allocation order and throttle allocations

illumos/illumos-gate@0f7643c7376dd69a08acbfc9d1d7d548b10c846a
https://github.com/illumos/illumos-gate/commit/0f7643c7376dd69a08acbfc9d1d7d548b10c846a

https://www.illumos.org/issues/7090
  When write I/Os are issued, they are issued in block order but the ZIO pipeline
  will drive them asynchronously through the allocation stage which can result in
  blocks being allocated out-of-order. It would be nice to preserve as much of
  the logical order as possible.
  In addition, the allocations are equally scattered across all top-level VDEVs
  but not all top-level VDEVs are created equally. The pipeline should be able to
  detect devices that are more capable of handling allocations and should
  allocate more blocks to those devices. This allows for dynamic allocation
  distribution when devices are imbalanced as fuller devices will tend to be
  slower than empty devices.
  The change includes a new pool-wide allocation queue which would throttle and
  order allocations in the ZIO pipeline. The queue would be ordered by issued
  time and offset and would provide an initial amount of allocation of work to
  each top-level vdev. The allocation logic utilizes a reservation system to
  reserve allocations that will be performed by the allocator. Once an allocation
  is successfully completed it's scheduled on a given top-level vdev. Each top-
  level vdev maintains a maximum number of allocations that it can handle
  (mg_alloc_queue_depth). The pool-wide reserved allocations (top-levels *
  mg_alloc_queue_depth) are distributed across the top-level vdevs metaslab
  groups and round robin across all eligible metaslab groups to distribute the
  work. As top-levels complete their work, they receive additional work from the
  pool-wide allocation queue until the allocation queue is emptied.

Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: George Wilson <george.wilson@delphix.com>

7 years ago7085 add support for "if" and "else" statements in dtrace
Mark Johnston [Sat, 13 Aug 2016 19:57:36 +0000 (19:57 +0000)]
7085 add support for "if" and "else" statements in dtrace

illumos/illumos-gate@c3bd3abd8856e8e75d820f65c58031cd6cbac818

Add syntactic sugar to dtrace: "if" and "else" statements. The sugar is
baked down to standard dtrace features by adding additional clauses with
the appropriate predicates.

Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago5396 fix longjmp clobbering errors
Mark Johnston [Sat, 13 Aug 2016 19:54:32 +0000 (19:54 +0000)]
5396 fix longjmp clobbering errors

illumos/illumos-gate@67a4bb8f9ad4c49e9aa9e21e2114a7c093c3a73a

Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Gary Mills <gary_mills@fastmail.fm>

7 years ago7164 zdb should be able to open the root dataset
Andriy Gapon [Wed, 20 Jul 2016 09:58:10 +0000 (09:58 +0000)]
7164 zdb should be able to open the root dataset

illumos/illumos-gate@b702644a6eb66615d67b492fd73ecd9efa11fc7d
https://github.com/illumos/illumos-gate/commit/b702644a6eb66615d67b492fd73ecd9efa11fc7d

https://www.illumos.org/issues/7164
  If the pool/dataset command-line argument is specified with a trailing
  slash, for example, "tank/", we should interpret it as the topmost
  dataset (rather than the whole pool)

Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Tim Chase <tim@chase2k.com>

7 years ago6391 Override default SPA config location via environment
Andriy Gapon [Wed, 20 Jul 2016 09:57:16 +0000 (09:57 +0000)]
6391 Override default SPA config location via environment

illumos/illumos-gate@ae24175b2b25e9fb4bfd9ac0648b57e0735b6651
https://github.com/illumos/illumos-gate/commit/ae24175b2b25e9fb4bfd9ac0648b57e0735b6651

https://www.illumos.org/issues/6391
  When using zdb with non-default SPA config file it is not convenient
  to add -U <non-default-config-file-path> all the time. This commit
  introduces support for setting/overriding SPA config location via
  environment variable 'SPA_CONFIG_PATH'.
  If -U flag is specified in the command line it will override any other
  value as usual.

https://github.com/zfsonlinux/zfs/commit/64d7b6cf75e52a4698d9bdec61745573c39d2e5a

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Richard Yao <ryao@gentoo.org>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Cyril Plisko <cyril.plisko@mountall.com>

7 years ago7163 ztest failures due to excess error injection
Andriy Gapon [Wed, 20 Jul 2016 09:54:18 +0000 (09:54 +0000)]
7163 ztest failures due to excess error injection

illumos/illumos-gate@f34284d835bc555f987c1310df46c034c3101155
https://github.com/illumos/illumos-gate/commit/f34284d835bc555f987c1310df46c034c3101155

https://www.illumos.org/issues/7163
  Running zloop from zfs-precommit hit this assertion:
       *panicstr/s
  0xfffffd7fd7419370: assertion failed for thread 0xfffffd7fe29ed240,
  thread-id 577: parent != NULL, file ../../../uts/common/fs/zfs/dbuf.c, line
  1827
       $c
  libc.so.1`_lwp_kill+0xa()
  libc.so.1`_assfail+0x182(fffffd7ffb1c29fafffffd7ffb1cc028, 723)
  libc.so.1`assfail+0x19(fffffd7ffb1c29fafffffd7ffb1cc028, 723)
  libzpool.so.1`dbuf_dirty+0xc69(10e3bc103601700)
  libzpool.so.1`dbuf_dirty+0x61e(10c736403601700)
  libzpool.so.1`dbuf_dirty+0x61e(10e282803601700)
  libzpool.so.1`dmu_buf_will_fill+0x64(10e282803601700)
  libzpool.so.1`dmu_write+0x1b6(2c7e640, d, 400000002e000000, 200, 3717b40,
  3601700)
  ztest_replay_write+0x568(4950d0, 3717a80, 0)
  ztest_write+0x125(4950d0, d, 400000002e000000, 200, 413f000)
  ztest_io+0x1bb(4950d0, d, 400000002e000000)
  ztest_dmu_write_parallel+0xaa(4950d0, 6)
  ztest_execute+0x83(1, 420c98, 6)
  ztest_thread+0xf4(6)
  libc.so.1`_thrp_setup+0x8a(fffffd7fe29ed240)
  libc.so.1`_lwp_start()
  This is another manifestation of ECKSUM in ztest:
  The lowest level ancestor that’s in memory is the L8 (topmost). The L7
  ancestor is blkid 0x10:
       ::dbufs -O 0x2c7e640 -o d -l 7 |::dbuf
  addr object lvl blkid holds os
  600be50 d 7 4 1 ztest/ds_6
  719d880 d 7 0 4 ztest/ds_6

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago6451 ztest fails due to checksum errors
Andriy Gapon [Wed, 20 Jul 2016 09:53:46 +0000 (09:53 +0000)]
6451 ztest fails due to checksum errors

illumos/illumos-gate@f9eb9fdf196b6ed476e4ffc69cecd8b0da3cb7e7
https://github.com/illumos/illumos-gate/commit/f9eb9fdf196b6ed476e4ffc69cecd8b0da3cb7e7

https://www.illumos.org/issues/6451
  Sometimes ztest fails because zdb detects checksum errors. e.g.:
  Traversing all blocks to verify checksums and verify nothing leaked ...
  zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 8000160> DVA0=<0:1cc2000:
  180000> [L0 other uint64[]] sha256 uncompressed LE contiguou
  s unique single size=100000L/100000P birth=271L/271P fill=1
  cksum=c5a3e27d1ed0f894:843bca3a5473c4bf:f76a19b6830a2e4:91292591613a12bf --
  skipping
  zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 800000180> DVA0=<0:ce16800:
  180000> [L0 other uint64[]] sha256 uncompressed LE contigu
  ous unique single size=100000L/100000P birth=840L/840P fill=1
  cksum=5d018f3d061e17f3:6d1584784587bf63:2805a74a0ce37369:ba68a214806c7e75
  -- skipping
  zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 1000000360> DVA0=<0:10d37400:
  180000> [L0 other uint64[]] sha256 uncompressed LE conti
  guous unique single size=100000L/100000P birth=904L/904P fill=1
  cksum=fa1e11d4138bd14b:86c9488c444473e3:f31e43c72e72e46b:e3446472d1174d
  ba -- skipping
  zdb_blkptr_cb: Got error 50 reading <71, 47, 0, 400000002c0> DVA0=<0:127ef400:
  180000> [L0 other uint64[]] sha256 uncompressed LE cont
  iguous dedup single size=100000L/100000P birth=549L/549P fill=1
  cksum=30e14955ebf13522:66dc2ff8067e6810:4607e750abb9d3b3:6582b8af909fcb
  58 -- skipping
  zdb_blkptr_cb: Got error 50 reading <657, 5, 0, 1c0> DVA0=<0:1a180400:180000>
  [L0 other uint64[]] fletcher4 uncompressed LE contiguou
  s unique single size=100000L/100000P birth=1091L/1091P fill=1 cksum=a6cf1e50:
  29b3bd01c57e5:36779b914035db9a:db61cdcf6bec56f0 -- skippin
  g
  The problem is that ztest_fault_inject() can inject multiple faults into the
  same block. It is designed such that it can inject errors on all leafs of a
  RAID-Z or mirror, but for a given range of offsets, it will only inject errors

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Jorgen Lundman <lundman@lundman.net>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago7147 ztest: ztest_ddt_repair fails with ztest_pattern_match assertion
Andriy Gapon [Wed, 20 Jul 2016 09:51:33 +0000 (09:51 +0000)]
7147 ztest: ztest_ddt_repair fails with ztest_pattern_match assertion

illumos/illumos-gate@aab80726335c76a7cae32c7300890248d73a51e3
https://github.com/illumos/illumos-gate/commit/aab80726335c76a7cae32c7300890248d73a51e3

https://www.illumos.org/issues/7147
  Here's the dbuf we're currently reading:
       966f200::dbuf
  addr object lvl blkid holds os
  966f200 4 0 0 1 ztest/ds_3
       966f200::print dmu_buf_t db_data
  db_data = 0x9ae0400
       0x9ae0400/10J
  0x9ae0400: c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d
  c1c7ced932020d c1c7ced932020d c1c7ced932020d c1c7ced932020d
  c1c7ced932020d c1c7ced932020d
  The pattern we're expecting is actually this: a34ae10b5f2db2. If we attempt to
  read the block on disk we find that it has matches what ztest_ddt_repair()
  would have written:
       ~c1c7ced932020d=J
  ff3e383126cdfdf2
       966f200::print dmu_buf_impl_t db_blkptr | ::blkptr
  DVA0=<0:71d3c00:800>
  [L0 UINT64_OTHER] SHA256 OFF LE contiguous dedup single
  size=400L/400P birth=55L/55P fill=1
  cksum=18486450d3ce8c6d:75a72f4bbf117b0f:2d3a226314eb5650:2eb0fd68648b1af0
     1. zdb -U /rpool/tmp/zpool.cache -R ztest 0:71d3c00:800 | head
        Found vdev type: mirror
  0:71d3c00:800
  0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
  000000: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>.
  000010: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>.
  000020: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>.
  000030: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>.
  000040: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>.
  000050: ff3e383126cdfdf2 ff3e383126cdfdf2 ...&18>....&18>.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: George Wilson <george.wilson@delphix.com>

7 years ago7086 ztest attempts dva_get_dsize_sync on an embedded blockpointer
Andriy Gapon [Wed, 20 Jul 2016 09:49:09 +0000 (09:49 +0000)]
7086 ztest attempts dva_get_dsize_sync on an embedded blockpointer

illumos/illumos-gate@926549256b71acd595f69b236779ff6b78fa08ef
https://github.com/illumos/illumos-gate/commit/926549256b71acd595f69b236779ff6b78fa08ef

https://www.illumos.org/issues/7086
  In dbuf_dirty(), we need to grab the dn_struct_rwlock before looking at the
  db_blkptr, to prevent it from being changed by syncing context.
  Otherwise we may see that ztest got a segfault from this stack:
  libzpool.so.1`dva_get_dsize_sync+0x98(872f000b32b240fed7811b, 0, b4cda20, 0)
  libzpool.so.1`bp_get_dsize+0x60(872f000b32b240, 0, 97cb7809d4c1a8, 0)
  libzpool.so.1`dbuf_dirty+0x9b3(ce0a10097cb780, 9, fecd2530)
  libzpool.so.1`dmu_buf_will_dirty+0xc3(ce0a10097cb780ea293d6c, 1)
  libzpool.so.1`zap_lockdir+0x1a0(8aaa3c0, 1, 0, 97cb780, 1, 1)
  libzpool.so.1`zap_remove_norm+0x30(8aaa3c0, 1, 0, 8728b10, 0, 97cb780)
  libzpool.so.1`zap_remove+0x29(8aaa3c0, 1, 0, 8728b1097cb780, a)
  ztest_replay_remove+0x225(ea2945888728ae8, 0, 38010000, 0, 0)
  ztest_remove+0x9f(ea294588ea293f50, 4, 3)
  ztest_object_init+0x78(ea294588ea293f50, 4e0, 1)
  ztest_dmu_object_alloc_free+0x71(ea294588, 13)
  ztest_dmu_objset_create_destroy+0x224(80cef08, 13, 0, 805d36c9017ad44, 0)
  ztest_execute+0x89(a, 807c720, 13, 0)
  ztest_thread+0xea(13, 0, 0, 0)
  libc.so.1`_thrp_setup+0x88(f0983240)
  libc.so.1`_lwp_start(f0983240, 0, 0, 0, 0, 0)
  Looking into it a bit, we see that this is an embedded blockpointer, so
  BP_GET_NDVAS should have returned 0:
       b32b240::blkptr
  EMBEDDED [L0 ZAP_OTHER] et=0 LZ4 size=200L/4aP birth=80L
  Instead, it looks like another thread is modifying this blockpointer:
       b32b240::ugrep | ::whatis
  f47a0e0c is in [ stack tid=0x19f ]
  ebd6ec40 is in [ stack tid=0x226 ]
  ea293bd0 is in [ stack tid=0x244 ]
  ea293be4 is in [ stack tid=0x244 ]

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago7072 zfs fails to expand if lun added when os is in shutdown state
Andriy Gapon [Wed, 20 Jul 2016 09:47:35 +0000 (09:47 +0000)]
7072 zfs fails to expand if lun added when os is in shutdown state

illumos/illumos-gate@c39a2aae1e2c439d156021edfc20910dad7f9891
https://github.com/illumos/illumos-gate/commit/c39a2aae1e2c439d156021edfc20910dad7f9891

https://www.illumos.org/issues/7072
  upstream:
  38733 zfs fails to expand if lun added when os is in shutdown state
  DLPX-36910 spares and caches should not display expandable space
  DLPX-39262 vdev_disk_open spam zfs_dbgmsg buffer

Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: George Wilson <george.wilson@delphix.com>

7 years ago7104 increase indirect block size
Andriy Gapon [Mon, 18 Jul 2016 07:03:39 +0000 (07:03 +0000)]
7104 increase indirect block size

illumos/illumos-gate@4b5c8e93cab28d3c65ba9d407fd8f46e3be1db1c
https://github.com/illumos/illumos-gate/commit/4b5c8e93cab28d3c65ba9d407fd8f46e3be1db1c

https://www.illumos.org/issues/7104
  The current default indirect block size is 16KB. We can improve
  performance by increasing it to 128KB. This is especially helpful for
  any workload that needs to read most of the metadata, e.g.
  scrub/resilver, file deletion, filesystem deletion, and zfs send.
  We also need to fix a few space estimation errors to make the tests
  pass.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago7071 lzc_snapshot does not fill in errlist on ENOENT
Andriy Gapon [Mon, 18 Jul 2016 06:58:39 +0000 (06:58 +0000)]
7071 lzc_snapshot does not fill in errlist on ENOENT

illumos/illumos-gate@25f7d993adbfb3452ac4625b3791670746d35ae3
https://github.com/illumos/illumos-gate/commit/25f7d993adbfb3452ac4625b3791670746d35ae3

https://www.illumos.org/issues/7071
  upstream
  DLPX-40482 lzc_snapshot does not fill in errlist on ENOENT

Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago6950 ARC should cache compressed data
Andriy Gapon [Mon, 18 Jul 2016 06:57:24 +0000 (06:57 +0000)]
6950 ARC should cache compressed data

illumos/illumos-gate@dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2
https://github.com/illumos/illumos-gate/commit/dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2

https://www.illumos.org/issues/6950
  When reading compressed data from disk, the ARC should keep the compressed
  block cached and only decompress it when consumers access the block. The
  uncompressed data should be short-lived allowing the ARC to cache a much larger
  amount of data. The DMU would also maintain a smaller cache of uncompressed
  blocks to minimize the impact of decompressing frequently accessed blocks.

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: George Wilson <george.wilson@delphix.com>

7 years ago6447 handful of nvpair cleanups
Andriy Gapon [Tue, 12 Jul 2016 12:05:58 +0000 (12:05 +0000)]
6447 handful of nvpair cleanups

illumos/illumos-gate@759e89be359f2af635e4122d147df56bce948773
https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bce948773

https://www.illumos.org/issues/6447
  I got a patch from someone who uses nvpair code outside of illumos. It fixes a
  couple of gcc warnings/bugs for him.
     1. silence uninitialized use warnings
     2. add parentheses around assignment used as truth value
     3. fix printf format specifier (ll is for integers only)
     4. strstr, strspn, strcspn, and strcmp are declared in string.h, not
        strings.h.
     5. avoid scanning integer into boolean variable

Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Steve Dougherty <sdougherty@barracuda.com>

7 years ago7082 bptree_iterate() passes wrong args to zfs_dbgmsg()
Andriy Gapon [Tue, 12 Jul 2016 12:03:00 +0000 (12:03 +0000)]
7082 bptree_iterate() passes wrong args to zfs_dbgmsg()

illumos/illumos-gate@10e67aa0db0823d5464aafdd681f3c966155c68e
https://github.com/illumos/illumos-gate/commit/10e67aa0db0823d5464aafdd681f3c966155c68e

https://www.illumos.org/issues/7082
  upstream
  DLPX-40542 bptree_iterate() passes wrong args to zfs_dbgmsg()

Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago6314 buffer overflow in dsl_dataset_name
Andriy Gapon [Tue, 12 Jul 2016 12:01:54 +0000 (12:01 +0000)]
6314 buffer overflow in dsl_dataset_name

illumos/illumos-gate@9adfa60d484ce2435f5af77cc99dcd4e692b6660
https://github.com/illumos/illumos-gate/commit/9adfa60d484ce2435f5af77cc99dcd4e692b6660

https://www.illumos.org/issues/6314
  Callers of dsl_dataset_name pass a buffer of size ZFS_MAXNAMELEN, but
  dsl_dataset_name copies the datasets' name PLUS the snapshot name to it,
  resulting in a max of 2 * ZFS_MAXNAMELEN + '@'.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago6931 lib/libzfs: cleanup gcc warnings
Andriy Gapon [Tue, 12 Jul 2016 12:00:31 +0000 (12:00 +0000)]
6931 lib/libzfs: cleanup gcc warnings

illumos/illumos-gate@88f61dee20b358671b1b643e9d1dbf220a1d69be
https://github.com/illumos/illumos-gate/commit/88f61dee20b358671b1b643e9d1dbf220a1d69be

https://www.illumos.org/issues/6931
  need cleanup:
  CERRWARN += -_gcc=-Wno-switch
  CERRWARN += -_gcc=-Wno-parentheses
  CERRWARN += -_gcc=-Wno-unused-function

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Igor Kozhukhov <ikozhukhov@gmail.com>

7 years ago6872 zfs libraries should not allow uninitialized variables
Andriy Gapon [Tue, 12 Jul 2016 11:59:25 +0000 (11:59 +0000)]
6872 zfs libraries should not allow uninitialized variables

illumos/illumos-gate@f83b46baf98d276f5f84fa84c8b461f412ac1f5e
https://github.com/illumos/illumos-gate/commit/f83b46baf98d276f5f84fa84c8b461f412ac1f5e

https://www.illumos.org/issues/6872
  We compile the zfs libraries with -Wno-uninitialized. We should remove
  this. Change makefiles, fix new warnings, fix pbchk errors.

Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Paul Dagnelie <pcd@delphix.com>

7 years ago4521 zfstest is trying to execute evil "zfs unmount -a"
Andriy Gapon [Tue, 12 Jul 2016 11:58:04 +0000 (11:58 +0000)]
4521 zfstest is trying to execute evil "zfs unmount -a"

illumos/illumos-gate@8808ac5dae118369991f158b6ab736cb2691ecde
https://github.com/illumos/illumos-gate/commit/8808ac5dae118369991f158b6ab736cb2691ecde

https://www.illumos.org/issues/4521
  zfstest is trying to execute evil "zfs unmount -a", which fails (fortunately,
  as it would otherwise leave me with my ~ missing):
  03:44:11.86 cannot unmount '/export/home/yuri': Device busy cannot unmount '/
  export/home': Device busy
  03:44:11.86 ERROR: /usr/sbin/zfs unmount -a exited 1
  This affects, at least, zfs_mount_009_neg and zfs_mount_all_001_pos, both
  failing on that step. The pool containing the /export/home hierarchy is
  included in KEEP variable, but it doesn't seem to affect anything here.

Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

7 years ago5813 zfs_setprop_error(): Handle errno value E2BIG.
Andriy Gapon [Tue, 12 Jul 2016 11:56:45 +0000 (11:56 +0000)]
5813 zfs_setprop_error(): Handle errno value E2BIG.

illumos/illumos-gate@6fdcb3d1c2baae812d9cbce37b41469b924efd90
https://github.com/illumos/illumos-gate/commit/6fdcb3d1c2baae812d9cbce37b41469b924efd90

https://www.illumos.org/issues/5813
  Lets pull in this patch from freebsd:
  http://svnweb.freebsd.org/base?view=revision&revision=271764
  zfs_setprop_error(): Handle errno value E2BIG.
  This errno value is emitted by dsl_props_set_check() in
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c, and
  is used to mean that the property value is too long. For the record,
  the maximum length is ZAP_MAXVALUELEN, which is 8*1024 bytes.
  Instead of claiming an unknown error (and abort()ing), provide
  something more specific to the scenario involved. As far as I
  can tell, E2BIG is not emitted for any other scenario.
  MFC after: 1 week
  Sponsored by: Spectra Logic
  Affects: All ZFS versions starting 27 Feb 2009 (illumos ccba0801)
  This change modified the value returned by
  dsl_props_set_check(), so that it can distinguish between
  a name that's too long and a value that's too long, but
  libzfs was not updated accordingly.
  MFSpectraBSD: r1051499 on 2014/03/28 11:07:59

Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Will Andrews <will@freebsd.org>

7 years ago6873 zfs_destroy_snaps_nvl leaks errlist
Andriy Gapon [Tue, 12 Jul 2016 11:54:25 +0000 (11:54 +0000)]
6873 zfs_destroy_snaps_nvl leaks errlist

illumos/illumos-gate@4cde22c29999ffb907ca39d2ebd512812f7e5168
https://github.com/illumos/illumos-gate/commit/4cde22c29999ffb907ca39d2ebd512812f7e5168

https://www.illumos.org/issues/6873
  lzc_destroy_snaps() returns an nvlist in errlist.
  zfs_destroy_snaps_nvl() should nvlist_free() it before returning.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Chris Williamson <chris.williamson@delphix.com>

7 years ago6879 incorrect endianness swap for drr_spill.drr_length in libzfs_sendrecv.c
Andriy Gapon [Tue, 12 Jul 2016 11:52:33 +0000 (11:52 +0000)]
6879 incorrect endianness swap for drr_spill.drr_length in libzfs_sendrecv.c

illumos/illumos-gate@20fea7a47472aceb64d3ed48cc2a3ea268bc4795
https://github.com/illumos/illumos-gate/commit/20fea7a47472aceb64d3ed48cc2a3ea268bc4795

https://www.illumos.org/issues/6879
  In libzfs_sendrecv, there's a typo:
  case DRR_SPILL:
              if (byteswap) {
                  drr->drr_u.drr_write.drr_length =
                      BSWAP_64(drr->drr_u.drr_spill.drr_length);
              }
  Instead of drr_write.drr_length, we should be assigning the result of the
  byteswap to drr_spill.drr_length.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Dan Kimmel <dan.kimmel@delphix.com>

7 years ago6111 zfs send should ignore datasets created after the ending snapshot
Andriy Gapon [Tue, 12 Jul 2016 11:48:59 +0000 (11:48 +0000)]
6111 zfs send should ignore datasets created after the ending snapshot

illumos/illumos-gate@4a20c933b148de8a1c1d3538391c64284e636653
https://github.com/illumos/illumos-gate/commit/4a20c933b148de8a1c1d3538391c64284e636653

https://www.illumos.org/issues/6111
  If you create a zfs child folder, zfs send returns an error when a recursive
  incremental send is done between two snapshots made prior to the folder
  creation.
  The problem can be reproduced with the following steps.
  root@zfs:/# zfs create pool/test
  root@zfs:/# zfs snapshot pool/test@snap1
  root@zfs:/# zfs snapshot pool/test@snap2
  root@zfs:/# zfs create pool/test/child
  root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap2 > /dev/null
  WARNING: could not send pool/test/child@snap2: does not exist
  WARNING: could not send pool/test/child@snap2: does not exist
  root@zfs:/# echo $?
  1
  root@zfs:/# zfs snapshot -r pool/test@snap3
  root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap3 > /dev/null
  root@zfs:/# echo $?
  0
  root@zfs:/# zfs send -R -I pool/test@snap2 pool/test@snap3 > /dev/null
  root@zfs:/# echo $?
  0
  Since pool/test/child was created after snap2, zfs send should not expect snap2
  to be in pool/test/child when doing a recursive send. It should examine the
  compare the creation time of the snapshot and each child folder to decide if
  the folder will be sent. The next incremental send between snap2 and snap3
  would properly create the child folder and snap3 which first appears in the
  child folder.
  The problem is identical if '-i' is used instead of '-I'.

Reviewed by: Alex Aizman alex.aizman@nexenta.com
Reviewed by: Alek Pinchuk alek.pinchuk@nexenta.com
Reviewed by: Roman Strashkin roman.strashkin@nexenta.com
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Alex Deiter <alex.deiter@nexenta.com>

7 years ago5768 zfsctl_snapshot_inactive() can leak a vnode hold
Andriy Gapon [Tue, 12 Jul 2016 11:46:13 +0000 (11:46 +0000)]
5768 zfsctl_snapshot_inactive() can leak a vnode hold

illumos/illumos-gate@20a95fb2c4af266e063e0cf86037f910a303c710
https://github.com/illumos/illumos-gate/commit/20a95fb2c4af266e063e0cf86037f910a303c710

https://www.illumos.org/issues/5768
  zfsctl_snapshot_inactive() leaks a hold on the dvp (directory vnode) if v_count > 1.
  reproduce by:
  create a fs with 100 snapshots.
  have a thread do:
  while true; do ls -l /test/snaps/.zfs/snapshot >/dev/null; done
  have another thread do:
  while true; do zfs promote test/clone; zfs promote test/snaps; done
  use dtrace to delay & observe:
  dtrace -w -xd \\
  -n 'vn_rele:entry/args0 == (void*)0xffffff01dd42ce80ULL/{[stack()]=count();
  chill(100000);}' \\
  -n 'zfsctl_snapshot_inactive:entry{ if (args[0]->v_count > 1) trace(args[0]-
  >v_count); self->vp=args[0];}' \\
  -n 'gfs_vop_inactive:entry/callers["zfsctl_snapshot_inactive"]/{self->good=1;
  [stack()]=count()}' \\
  -n 'zfsctl_snapshot_inactive:return{if (self->good) self->good=0; else printf
  ("bad return");}' \\
  -n 'gfs_dir_lookup:return/callers["zfsctl_snapshot_inactive"] && self->vp-
  >v_count > 1/{trace(self->vp->v_count)}'
  the address is found by selecting one of the output of this at random:
  dtrace -n 'zfsctl_snapshot_inactive:entry{print(args[0]);'
  when you see "bad return", we have hit the bug. Then doing "zfs umount test/
  snaps" will fail with EBUSY.
  When we hit this case, we also leak the hold on the target vnode (vn). When the
  inactive callback is called on a vnode with v_count > 1, it needs to be
  decremented.

Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Adam Leventhal <adam.leventhal@delphix.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Rich Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago7054 dmu_tx_hold_t should use refcount_t to track space
Andriy Gapon [Tue, 12 Jul 2016 11:37:19 +0000 (11:37 +0000)]
7054 dmu_tx_hold_t should use refcount_t to track space

illumos/illumos-gate@0c779ad424a92a84d1e07d47cab7f8009189202b
https://github.com/illumos/illumos-gate/commit/0c779ad424a92a84d1e07d47cab7f8009189202b

https://www.illumos.org/issues/7054
  upstream:
  ee0003de7d3e598499be7ac3fe6b61efcc47cb7f
  DLPX-40399 dmu_tx_hold_t should use refcount_t to track space

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago6940 Cannot unlink directories when over quota
Andriy Gapon [Tue, 12 Jul 2016 11:36:22 +0000 (11:36 +0000)]
6940 Cannot unlink directories when over quota

illumos/illumos-gate@99189164df06057fb968ca7be701bb1a0d5da8c9
https://github.com/illumos/illumos-gate/commit/99189164df06057fb968ca7be701bb1a0d5da8c9

https://www.illumos.org/issues/6940
  Similar to #6334, but this time with empty directories:
  $ zfs create tank/quota
  $ zfs set quota=10M tank/quota
  $ zfs snapshot tank/quota@snap1
  $ zfs set mountpoint=/mnt/tank/quota tank/quota
  $ mkdir /mnt/tank/quota/dir # create an empty directory
  $ mkfile 11M /mnt/tank/quota/11M
  /mnt/tank/quota/11M: initialized 9830400 of 11534336 bytes: Disc quota exceeded
  $ rmdir /mnt/tank/quota/dir # now unlink the empty directory
  rmdir: directory "/mnt/tank/quota/dir": Disc quota exceeded
  From user perspective, I would expect that ZFS is always able to remove files
  and directories even when the quota is exceeded.

Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Simon Klinkert <simon.klinkert@gmail.com>

7 years ago7016 arc_available_memory is not 32-bit safe
Andriy Gapon [Tue, 12 Jul 2016 11:35:07 +0000 (11:35 +0000)]
7016 arc_available_memory is not 32-bit safe

illumos/illumos-gate@0dd053d7d890618ea1fc697b07de364e69eb4190
https://github.com/illumos/illumos-gate/commit/0dd053d7d890618ea1fc697b07de364e69eb4190

https://www.illumos.org/issues/7016
  upstream DLPX-39446 arc_available_memory is not 32-bit safe
  https://github.com/delphix/delphix-os/commit/
  6b353ea3b8a1610be22e71e657d051743c64190b
  related to this upstream:
  DLPX-38547 delphix engine hang
  https://github.com/delphix/delphix-os/commit/
  3183a567b3e8c62a74a65885ca60c86f3d693783
  DLPX-38547 delphix engine hang (fix static global)
  https://github.com/delphix/delphix-os/commit/
  22ac551d8ef085ad66cc8f65e51ac372b12993b9
  DLPX-38882 system hung waiting on free segment
  https://github.com/delphix/delphix-os/commit/
  cdd6beef7548cd3b12f0fc0328eeb3af540079c2

Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Gordon Ross <gordon.ross@nexenta.com>
Author: Prakash Surya <prakash.surya@delphix.com>

7 years ago7019 zfsdev_ioctl skips secpolicy when FKIOCTL is set
Andriy Gapon [Tue, 12 Jul 2016 11:34:05 +0000 (11:34 +0000)]
7019 zfsdev_ioctl skips secpolicy when FKIOCTL is set

7020 sdev_cleandir can loop forever

Note that the bulk of the upstream change is not applicable to FreeBSD
and the affected files are not even in the vendor area.

illumos/illumos-gate@45b1747515a17db45e8971501ee84a26bdff37b2
https://github.com/illumos/illumos-gate/commit/45b1747515a17db45e8971501ee84a26bdff37b2

https://www.illumos.org/issues/7019
  Currently zfsdev_ioctl, when confronted by a request with the FKIOCTL flag set,
  skips all processing of secpolicy functions. This means that ZFS is not doing
  any kind of verification of the credentials or access rights of the caller and
  assuming that (as it is an in-kernel client) all such checks have already been
  done.
  This turns out to be quite a dangerous assumption, especially with respect to
  sdev. In general I don't think it's particularly reasonable to offload this
  enforcement of access rights onto other kernel subsystems when ZFS has some
  particular local semantics in this area (delegated datasets etc) and does not
  provide any kind of API to allow other subsystems to avoid code duplication
  when doing it. ZFS should apply its normal access policy to requests from
  within the kernel, and callers should take care to give it the correct
  credentials and call it from the correct context in order to get the results
  they need.
  You can observe the currently unfortunate consequences of this bug in any non-
  global zone that has access to /dev/zvol or any subset of it via sdev profiles.
  In particular, a zone used to contain a KVM or similar which has a single zvol
  passed through to it using a <device match= block in its zone XML.
  Even though sdev makes something of an attempt to control for whether the
  caller should have access to nodes in /dev/zvol, it doesn't do this correctly,
  or really at all in the lookup call path. So, if we have a zone that's been
  given access to any part of /dev/zvol, it can simply look up the full path to
  any other zvol on the entire system, and the node will appear and be able to be
  used.

https://www.illumos.org/issues/7020
  sdev_cleandir can currently hang forever when it encounters a child node that
  is busy, or when it is given a matching expr and the first entry on the list
  does not match.
  The previous code (circa 2013) iterated over the children of the node using a
  for loop with SDEV_NEXT_ENTRY, which was then changed to a while ((dv =
  SDEV_FIRST_ENTRY(ddv)) { loop. Unfortunately the continue statements that
  previously made it skip over an entry were left as they were, which now result
  in an infinite busy-loop in the kernel.
  You can trigger this pretty easily by setting up an sdev exclude rule in
  zonecfg.
  Diagnosis: look for a runaway process consuming 100% CPU in kernel -- they have
  a distinctive stack:
  # mdb -k
  > 0t1234::pid2proc | ::walk thread | ::findstack -v
  [ ffffd001efcd3310 _resume_from_idle+0x112() ]
    ffffd001efcd3360 apix_hilevel_intr_epilog+0xc1(ffffd001efcd33d0, 0)
    ffffd001efcd33c0 apix_do_interrupt+0x34a(ffffd001efcd33d0, 0)
    ffffd001efcd33d0 _sys_rtt_ints_disabled+8()
    ffffd001efcd3550 rw_enter+0x58()
    ffffd001efcd35e0 sdev_cleandir+0x60(ffffd0631b6d75d8, 0, 0)
    ffffd001efcd3630 devzvol_prunedir+0xec(ffffd0631b6d76e8)
    ffffd001efcd36d0 devzvol_readdir+0x150(ffffd06333250e00ffffd001efcd3790,
  ffffd062dc990e18ffffd001efcd37dc, 0, 0)
    ffffd001efcd3760 fop_readdir+0x6b(ffffd06333250e00ffffd001efcd3790,
  ffffd062dc990e18ffffd001efcd37dc, 0, 0)
    ffffd001efcd3830 walk_dir+0xee(ffffd06333250e00ffffd0669e4483c8,
  fffffffffbbdf410)
    ffffd001efcd3850 prof_make_names_walk+0x2e(ffffd0669e4483c8,
  fffffffffbbdf410)
    ffffd001efcd38b0 prof_make_names+0xfc(ffffd0669e4483c8)

Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alex Wilson <alex.wilson@joyent.com>

7 years ago6922 Emit ESC_ZFS_VDEV_REMOVE_AUX after removing an aux device
Andriy Gapon [Tue, 12 Jul 2016 11:29:19 +0000 (11:29 +0000)]
6922 Emit ESC_ZFS_VDEV_REMOVE_AUX after removing an aux device

illumos/illumos-gate@63364b0ee2604783e7a55f8425888867768eafa4
https://github.com/illumos/illumos-gate/commit/63364b0ee2604783e7a55f8425888867768eafa4

https://www.illumos.org/issues/6922
  ZFS does not do a config_sync after removing an aux (spare, log, or cache)
  device. AFAICT this isn't being done because it is slow and was deemed
  unnecessary. However, it should be such a rare operation that speed doesn't
  matter, and not doing it results in two problems:
  1) It is theoretically possible to remove an aux device from one pool and
  attach it to another, then lose power. When power is restored, both pools would
  think that they own the aux device.
  2) Removal of the aux device doesn't send any useful sysevents to userland.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alan Somers <asomers@gmail.com>

7 years ago6980 6902 causes zfs send to break due to 32-bit/64-bit struct mismatch
Andriy Gapon [Tue, 12 Jul 2016 11:27:17 +0000 (11:27 +0000)]
6980 6902 causes zfs send to break due to 32-bit/64-bit struct mismatch

illumos/illumos-gate@ea4a67f462de0a39a9adea8197bcdef849de5371
https://github.com/illumos/illumos-gate/commit/ea4a67f462de0a39a9adea8197bcdef849de5371

https://www.illumos.org/issues/6980
  doing zfs send -i snap1 snap2 >testfile results in
  internal error: Invalid argument
  Abort (core dumped)

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago6878 Add scrub completion info to "zpool history"
Andriy Gapon [Tue, 12 Jul 2016 11:25:55 +0000 (11:25 +0000)]
6878 Add scrub completion info to "zpool history"

illumos/illumos-gate@1825bc56e5a1f7ef6f0dc3137f3b35f5850c1100
https://github.com/illumos/illumos-gate/commit/1825bc56e5a1f7ef6f0dc3137f3b35f5850c1100

https://www.illumos.org/issues/6878
  Summary of changes:
      * Replace generic "scan done" message with "scan aborted, restarting",
        "scan cancelled", or "scan done"
      * Log number of errors using spa_get_errlog_size
      * Refactor scan restarting check into static function

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Nav Ravindranath <nav@delphix.com>

7 years ago6513 partially filled holes lose birth time
Andriy Gapon [Tue, 12 Jul 2016 11:24:55 +0000 (11:24 +0000)]
6513 partially filled holes lose birth time

illumos/illumos-gate@8df0bcf0df7622a075cc6e52f659d2fcfdd08cdc
https://github.com/illumos/illumos-gate/commit/8df0bcf0df7622a075cc6e52f659d2fcfdd08cdc

https://www.illumos.org/issues/6513
  If a ZFS object contains a hole at level one, and then a data block is created
  at level 0 underneath that l1 block, l0 holes will be created. However, these
  l0 holes do not have the birth time property set; as a result, incremental
  sends will not send those holes.
  Fix is to modify the dbuf_read code to fill in birth time data.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Paul Dagnelie <pcd@delphix.com>

7 years ago6902 speed up listing of snapshots if requesting name only and sorting by name
Andriy Gapon [Tue, 12 Jul 2016 11:21:41 +0000 (11:21 +0000)]
6902 speed up listing of snapshots if requesting name only and sorting by name

illumos/illumos-gate@0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d
https://github.com/illumos/illumos-gate/commit/0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d

https://www.illumos.org/issues/6902
  pjd has authored and commited a patch in Jan 21, 2012 that substanially speeds
  up zfs snapshot listing if requesting only the name property and sorting by
  name.
  In this special case, the snapshot properties do not need to be loaded. This
  code has been adopted by zfsonlinux on May 29, 2012.
  Commit message from pjd:
       Dramatically optimize listing snapshots when user requests only
       snapshot
       names and wants to sort them by name, ie. when executes:
          1. zfs list -t snapshot -o name -s name
       Because only name is needed we don't have to read all snapshot
       properties.
       Below you can find how long does it take to list 34509 snapshots from
       a single
       disk pool before and after this change with cold and warm cache:
       before:
          1. time zfs list -t snapshot -o name -s name > /dev/null
             cold cache: 525s
             warm cache: 218s
       after:
          1. time zfs list -t snapshot -o name -s name > /dev/null
             cold cache: 1.7s
             warm cache: 1.1s
  References:
  http://svnweb.freebsd.org/base?view=revision&revision=230438
  https://github.com/freebsd/freebsd/commit/8e3e9863
  https://github.com/zfsonlinux/zfs/commit/0cee2406

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Pawel Dawidek <pjd@freebsd.org>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Martin Matuska <martin@matuska.org>

7 years ago6876 Stack corruption after importing a pool with a too-long name
Andriy Gapon [Tue, 12 Jul 2016 11:20:00 +0000 (11:20 +0000)]
6876 Stack corruption after importing a pool with a too-long name

illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41
https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41

https://www.illumos.org/issues/6876
  Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
  trouble. We should check every dataset on import, using a 1024 byte buffer and
  checking each time to see if the dataset's new name is longer than 256 bytes.

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Paul Dagnelie <pcd@delphix.com>

7 years ago6844 dnode_next_offset can detect fictional holes
Andriy Gapon [Tue, 12 Jul 2016 11:18:25 +0000 (11:18 +0000)]
6844 dnode_next_offset can detect fictional holes

illumos/illumos-gate@11ceac77ea8034bf2fe9bdd6d314f5d1e5ceeba3
https://github.com/illumos/illumos-gate/commit/11ceac77ea8034bf2fe9bdd6d314f5d1e5ceeba3

https://www.illumos.org/issues/6844
  dnode_next_offset is used in a variety of places to iterate over the holes or
  allocated blocks in a dnode. It operates under the premise that it can iterate
  over the blockpointers of a dnode in open context while holding only the
  dn_struct_rwlock as reader. Unfortunately, this premise does not hold.
  When we create the zio for a dbuf, we pass in the actual block pointer in the
  indirect block above that dbuf. When we later zero the bp in
  zio_write_compress, we are directly modifying the bp. The state of the bp is
  now inconsistent from the perspective of dnode_next_offset: the bp will appear
  to be a hole until zio_dva_allocate finally finishes filling it in. In the
  meantime, dnode_next_offset can detect a hole in the dnode when none exists.
  I was able to experimentally demonstrate this behavior with the following
  setup:
  1. Create a file with 1 million dbufs.
  2. Create a thread that randomly dirties L2 blocks by writing to the first L0
  block under them.
  3. Observe dnode_next_offset, waiting for it to skip over a hole in the middle
  of a file.
  4. Do dnode_next_offset in a loop until we skip over such a non-existent hole.
  The fix is to ensure that it is valid to iterate over the indirect blocks in a
  dnode while holding the dn_struct_rwlock by passing the zio a copy of the BP
  and updating the actual BP in dbuf_write_ready while holding the lock.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alex Reece <alex@delphix.com>

7 years ago6874 rollback and receive need to reset ZPL state to what's on disk
Andriy Gapon [Tue, 12 Jul 2016 11:16:43 +0000 (11:16 +0000)]
6874 rollback and receive need to reset ZPL state to what's on disk

illumos/illumos-gate@1fdcbd00c9cbac286b5f92e08877e8cb3c448420
https://github.com/illumos/illumos-gate/commit/1fdcbd00c9cbac286b5f92e08877e8cb3c448420

https://www.illumos.org/issues/6874
  When we do a clone swap (caused by "zfs rollback" or "zfs receive"), the ZPL
  doesn't completely reload the state from the DMU; some values remain cached in
  the zfsvfs_t.
  steps to reproduce:
  ```
  #!/bin/bash -x
  zfs destroy -R test/fs
  zfs destroy -R test/recvd
  zfs create test/fs
  zfs snapshot test/fs@a
  zfs set userquota@$USER=1m test/fs
  zfs snapshot test/fs@b
  zfs send test/fs@a | zfs recv test/recvd
  zfs send -i @a test/fs@b | zfs recv test/recvd
  zfs userspace test/recvd
     1. should show 1m quota
        dd if=/dev/urandom of=/test/recvd/file bs=1k count=1024
        sync
        dd if=/dev/urandom of=/test/recvd/file2 bs=1k count=1024
     2. should fail with ENOSPC
        sync
        zfs unmount test/recvd
        zfs mount test/recvd
        zfs userspace test/recvd
     3. if bug above, now shows 1m quota
        dd if=/dev/urandom of=/test/recvd/file3 bs=1k count=1024
     4. if bug above, now fails with ENOSPC
  ```

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Matthew Ahrens <mahrens@delphix.com>

8 years ago7035 string-related subroutines should validate input earlier
Mark Johnston [Mon, 6 Jun 2016 22:09:22 +0000 (22:09 +0000)]
7035 string-related subroutines should validate input earlier

Reviewed by: Alex Wilson <alex.wilson@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Patrick Mooney <pmooney@pfmooney.com>

illumos/illumos-gate@771e39c3b1d6e2e0ba230442d782d83c60098296

8 years ago7033 ustack helper should fault on bad return values
Mark Johnston [Mon, 6 Jun 2016 22:07:55 +0000 (22:07 +0000)]
7033 ustack helper should fault on bad return values

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@a2f72b65ebc430aaf277ad797e554bb4deba9b95

8 years ago7034 negative record sizes should be rejected
Mark Johnston [Mon, 6 Jun 2016 22:06:45 +0000 (22:06 +0000)]
7034 negative record sizes should be rejected

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@0b8049bfb0e291160e960697b554596289d7f0bc

8 years ago6765 zfs_zaccess_delete() comments do not accurately reflect
Alexander Motin [Wed, 11 May 2016 13:51:53 +0000 (13:51 +0000)]
6765 zfs_zaccess_delete() comments do not accurately reflect
delete permissions for ACLs

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Kevin Crowe <kevin.crowe@nexenta.com>

openzfs/openzfs@a40149b935cbbe87bf95e2cc44b3bc99d400513a

8 years ago6764 zfs issues with inheritance flags during chmod(2) with
Alexander Motin [Wed, 11 May 2016 13:49:50 +0000 (13:49 +0000)]
6764 zfs issues with inheritance flags during chmod(2) with
aclmode=passthrough

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Albert Lee <trisk@nexenta.com>

openzfs/openzfs@1bcf0d240bdebed61b4261f7c0ee323e07c8dfac

8 years ago6763 aclinherit=restricted masks inherited permissions by group
Alexander Motin [Wed, 11 May 2016 13:46:44 +0000 (13:46 +0000)]
6763 aclinherit=restricted masks inherited permissions by group
perms (groupmask)

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Albert Lee <trisk@nexenta.com>

openzfs/openzfs@eebb483d0cd68bdc4cf03c01fdeba9af160c17af

8 years ago6762 POSIX write should imply DELETE_CHILD on directories - and
Alexander Motin [Wed, 11 May 2016 12:58:12 +0000 (12:58 +0000)]
6762 POSIX write should imply DELETE_CHILD on directories - and
some additional considerations

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Author: Kevin Crowe <kevin.crowe@nexenta.com>

openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916

8 years ago6736 ZFS per-vdev ZAPs
Alexander Motin [Wed, 11 May 2016 12:50:58 +0000 (12:50 +0000)]
6736 ZFS per-vdev ZAPs

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Joe Stein <joe.stein@delphix.com>

openzfs/openzfs@215198a6ad15cf4832370e2f19247abeb36b951a

8 years ago6842 Fix empty xattr dir causing lockup
Alexander Motin [Wed, 11 May 2016 12:45:21 +0000 (12:45 +0000)]
6842 Fix empty xattr dir causing lockup

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Chunwei Chen <tuxoko@gmail.com>

openzfs/openzfs@02525cd08fb3730fff3a69cb5376443d481f7839

8 years ago6843 Make xattr dir truncate and remove in one tx
Alexander Motin [Wed, 11 May 2016 12:39:53 +0000 (12:39 +0000)]
6843 Make xattr dir truncate and remove in one tx

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Chunwei Chen <tuxoko@gmail.com>

openzfs/openzfs@399cc7d5d9aff97c714b708af3e3f0280ceab93f

8 years ago6841 Undirty freed spill blocks
Alexander Motin [Wed, 11 May 2016 12:36:19 +0000 (12:36 +0000)]
6841 Undirty freed spill blocks

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Tim Chase <tim@chase2k.com>

openzfs/openzfs@445e67805dd2ca6c3a2363b2ec9e163c62370233

8 years ago6052 decouple lzc_create() from the implementation details
Andriy Gapon [Fri, 22 Apr 2016 12:51:55 +0000 (12:51 +0000)]
6052 decouple lzc_create() from the implementation details

illumos/illumos-gate@26455f9efcf9b1e44937d4d86d1ce37b006f25a9
https://github.com/illumos/illumos-gate/commit/26455f9efcf9b1e44937d4d86d1ce37b006f25a9

https://www.illumos.org/issues/6052
  At the moment type parameter of lzc_create() is of dmu_objset_type_t type.
  That exposes an implementation detail and requires sys/fs/zfs.h to be included
  in libzfs_core.h creating unnecessary coupling between libzfs_core interface
  and ZFS internals.
  I think that dmu_objset_type_t should be replaced with a libzfs_core
  enumeration of supported dataset types.
  For ABI reasons the new enumeration could be bit-compatible with
  dmu_objset_type_t.
  For example:
      typedef enum {
          LZC_DST_ZFS = 2,
          LZC_DST_ZVOL
      } lzc_dataset_type_t;

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

8 years ago6322 ZFS indirect block predictive prefetch
Alexander Motin [Mon, 11 Apr 2016 21:07:18 +0000 (21:07 +0000)]
6322 ZFS indirect block predictive prefetch

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Author: Alexander Motin <mav@FreeBSD.org>

Improve speculative prefetch of indirect blocks.

Scalability of many operations on wide ZFS pool can be limited by
requirement to prefetch indirect blocks first.  Recently added
asynchronous indirect block read partially helped, but did not
solve the problem completely.  This patch extends existing prefetcher
functionality to explicitly work with indirect blocks.

Before this change prefetcher issued reads for up to 8MB of data in
advance.  With this change it also issues indirect block reads
for up to 64MB of data in advance, so that when it will be time to
actually read those data, it can be done immediately.  Alike effect
can be achieved by just increasing maximal data prefetch distance,
but at higher memory cost.

Also this change introduces indirect block prefetch for rewrite
operations, that was never done before.  Previously ARC miss for
Indirect blocks regularly blocked rewrites, converting perfectly
aligned asynchronous operations into synchronous read-write pairs,
significantly reducing maximal rewrite speed.

While being there this issue was also fixed:
 - prefetch was done always, even if caching for the dataset was
completely disabled.

Testing on FreeBSD with zvol on top of 6x striped 2x mirrored pool
of 12 assorted HDDs shown me such performance numbers:
------- BEFORE --------
Write       491363677 bytes/sec
Read        312430631 bytes/sec
Rewrite      97680464 bytes/sec
-------- AFTER --------
Write       493524146 bytes/sec
Read        438598079 bytes/sec
Rewrite     277506044 bytes/sec

Closes #65
Closes #80

openzfs/openzfs@792fd28ac04f78cc5e43ead2d72a96f244ea84e8

8 years ago6418 zpool should have a label clearing command
Alexander Motin [Sat, 9 Apr 2016 19:49:40 +0000 (19:49 +0000)]
6418 zpool should have a label clearing command

Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Author: Will Andrews <will@firepipe.net>

Closes #83
Closes #32

8 years ago6738 zfs send stream padding needs documentation
Alexander Motin [Sat, 2 Apr 2016 08:25:41 +0000 (08:25 +0000)]
6738 zfs send stream padding needs documentation

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Eli Rosenthal <eli.rosenthal@delphix.com>

illumos/illumos-gate@c20404ff77119516354b0d112d28b7ea0dadd303

8 years ago6739 userland version of cv_timedwait_hires() always assumes absolute time
Alexander Motin [Sat, 2 Apr 2016 08:24:23 +0000 (08:24 +0000)]
6739 userland version of cv_timedwait_hires() always assumes absolute time

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: George Wilson <george.wilson@delphix.com>

illumos/illumos-gate@41c6413cb54bf338d7a59ed789ec2e0e44c35e6f

8 years ago6681 zfs list burning lots of time in dodefault() via dsl_prop_*
Alexander Motin [Sat, 2 Apr 2016 08:19:41 +0000 (08:19 +0000)]
6681 zfs list burning lots of time in dodefault() via dsl_prop_*

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@d09e4475f635b6f66ee68d8c17a32bba7be17c96

8 years ago6734 dtrace_canstore_statvar() fails for some valid static variables
Mark Johnston [Thu, 17 Mar 2016 18:49:37 +0000 (18:49 +0000)]
6734 dtrace_canstore_statvar() fails for some valid static variables

Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@d65f2bb4e50559c6c375a2aa9f728cbc34379015

8 years ago6370 ZFS send fails to transmit some holes
Alexander Motin [Thu, 10 Mar 2016 08:56:18 +0000 (08:56 +0000)]
6370 ZFS send fails to transmit some holes

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Chris Williamson <chris.williamson@delphix.com>
Reviewed by: Stefan Ring <stefanrin@gmail.com>
Reviewed by: Steven Burgess <sburgess@datto.com>
Reviewed by: Arne Jansen <sensille@gmx.net>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Paul Dagnelie <pcd@delphix.com>

In certain circumstances, "zfs send -i" (incremental send) can produce a
stream which will result in incorrect sparse file contents on the
target.

The problem manifests as regions of the received file that should be
sparse (and read a zero-filled) actually contain data from a file that
was deleted (and which happened to share this file's object ID).

Note: this can happen only with filesystems (not zvols, because they do
not free (and thus can not reuse) object IDs).

Note: This can happen only if, since the incremental source (FromSnap),
a file was deleted and then another file was created, and the new file
is sparse (i.e. has areas that were never written to and should be
implicitly zero-filled).

We suspect that this was introduced by 4370 (applies only if hole_birth
feature is enabled), and made worse by 5243 (applies if hole_birth
feature is disabled, and we never send any holes).

The bug is caused by the hole birth feature. When an object is deleted
and replaced, all the holes in the object have birth time zero. However,
zfs send cannot tell that the holes are new since the file was replaced,
so it doesn't send them in an incremental. As a result, you can end up
with invalid data when you receive incremental send streams. As a
short-term fix, we can always send holes with birth time 0 (unless it's
a zvol or a dataset where we can guarantee that no objects have been
reused).

Closes #37

8 years ago4448 zfs diff misprints unicode characters
Alexander Motin [Tue, 8 Mar 2016 18:51:12 +0000 (18:51 +0000)]
4448 zfs diff misprints unicode characters

Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Joshua M. Clulow <jmc@joyent.com>

illumos/illumos-gate@b211eb9181f99c20acbf4c528f94cb44b4ca8c31

8 years ago6544 incorrect comment in libzfs.h about offline status
Alexander Motin [Tue, 8 Mar 2016 18:47:24 +0000 (18:47 +0000)]
6544 incorrect comment in libzfs.h about offline status

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Gerhard Roethlin <git@the-color-black.net>

illumos/illumos-gate@cb605c4d8ab24b5a900b8b4ca85db65c22d05fad

8 years ago6551 cmd/zpool: cleanup gcc warnings
Alexander Motin [Tue, 8 Mar 2016 18:37:34 +0000 (18:37 +0000)]
6551 cmd/zpool: cleanup gcc warnings

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Approved by: Robert Mustacchi <rm@joyent.com>

illumos/illumos-gate@b327cd3f3b4dab4f29e7140159b1e01ed2ceef2a

8 years ago6550 cmd/zfs: cleanup gcc warnings
Alexander Motin [Tue, 8 Mar 2016 18:35:07 +0000 (18:35 +0000)]
6550 cmd/zfs: cleanup gcc warnings

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Igor Kozhukhov <ikozhukhov@gmail.com>

illumos/illumos-gate@c16bcc4577f389573eff411c7b7e040294078c3b

8 years ago6637 replacing "dontclose" with "should_close"
Alexander Motin [Tue, 8 Mar 2016 18:31:49 +0000 (18:31 +0000)]
6637 replacing "dontclose" with "should_close"

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: David Schwartz <dschwartz783@gmail.com>

illumos/illumos-gate@d189620258b3c9b0e2f7e2104840be2eee7c68e5

8 years ago6672 arc_reclaim_thread() should use gethrtime() instead of ddi_get_lbolt()
Alexander Motin [Tue, 8 Mar 2016 18:16:50 +0000 (18:16 +0000)]
6672 arc_reclaim_thread() should use gethrtime() instead of ddi_get_lbolt()
6673 want a macro to convert seconds to nanoseconds and vice-versa

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Eli Rosenthal <eli.rosenthal@delphix.com>

illumos/illumos-gate@a8f6344fa0921599e1f4511e41b5f9a25c38c0f9

8 years ago6659 nvlist_free(NULL) is a no-op
Alexander Motin [Tue, 8 Mar 2016 18:08:33 +0000 (18:08 +0000)]
6659 nvlist_free(NULL) is a no-op

Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Marcel Telka <marcel@telka.sk>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

illumos/illumos-gate@aab83bb83be7342f6cfccaed8d5fe0b2f404855d

8 years ago6541 Pool feature-flag check defeated if "verify" is included
Alexander Motin [Tue, 8 Mar 2016 17:56:40 +0000 (17:56 +0000)]
6541 Pool feature-flag check defeated if "verify" is included
in the dedup property value

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Richard Laager <rlaager@wiktel.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: ilovezfs <ilovezfs@icloud.com>

illumos/illumos-gate@971640e6aa954c91b0706543741aa4570299f4d7

8 years ago6562 Refquota on receive doesn't account for overage
Alexander Motin [Tue, 8 Mar 2016 17:52:43 +0000 (17:52 +0000)]
6562 Refquota on receive doesn't account for overage

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Dan McDonald <danmcd@omniti.com>

illumos/illumos-gate@5f7a8e6d750cb070a3347f045201c6206caee6aa

8 years ago5027 zfs large block support (add copyright)
Alexander Motin [Tue, 8 Mar 2016 17:48:26 +0000 (17:48 +0000)]
5027 zfs large block support (add copyright)

Author: Matthew Ahrens <matt@mahrens.org>

illumos/illumos-gate@c3d26abc9ee97b4f60233556aadeb57e0bd30bb9

8 years ago6536 zfs send: want a way to disable setting of DRR_FLAG_FREERECORDS
Alexander Motin [Tue, 8 Mar 2016 17:36:36 +0000 (17:36 +0000)]
6536 zfs send: want a way to disable setting of DRR_FLAG_FREERECORDS

Reviewed by: Anil Vijarnia <avijarnia@racktopsystems.com>
Reviewed by: Kim Shrier <kshrier@racktopsystems.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Andrew Stormont <astormont@racktopsystems.com>

illumos/illumos-gate@880094b6062aebeec8eda6a8651757611c83b13e

8 years ago6450 scrub/resilver unnecessarily traverses snapshots created
Alexander Motin [Tue, 8 Mar 2016 17:34:07 +0000 (17:34 +0000)]
6450 scrub/resilver unnecessarily traverses snapshots created
after the scrub started

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@38d61036746e2273cc18f6698392e1e29f87d1bf

8 years ago6537 Panic on zpool scrub with DEBUG kernel
Alexander Motin [Tue, 8 Mar 2016 17:29:57 +0000 (17:29 +0000)]
6537 Panic on zpool scrub with DEBUG kernel

Reviewed by: Steve Gonczi <gonczi@comcast.net>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Gary Mills <gary_mills@fastmail.fm>

illumos/illumos-gate@8c04a1fa3f7d569d48fe9b5342d0bd4c533179b9

8 years ago6531 Provide mechanism to artificially limit disk performance
Alexander Motin [Tue, 8 Mar 2016 16:11:59 +0000 (16:11 +0000)]
6531 Provide mechanism to artificially limit disk performance

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Prakash Surya <prakash.surya@delphix.com>

illumos/illumos-gate@97e81309571898df9fdd94aab1216dfcf23e060b

8 years ago6604 harden DIF bounds checking
Mark Johnston [Wed, 2 Mar 2016 05:43:16 +0000 (05:43 +0000)]
6604 harden DIF bounds checking

Author: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Alex Wilson <alex.wilson@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Robert Mustacchi <rm@joyent.com>

illumos/illumos-gate@1c0cef67dba05c477dba779bc99224693e809a14

8 years ago6358 A faulted pool with only unavailable vdevs triggers assertion
Alexander Motin [Fri, 29 Jan 2016 17:18:50 +0000 (17:18 +0000)]
6358 A faulted pool with only unavailable vdevs triggers assertion
failure in libzfs

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Serban Maduta <serban.maduta@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Dan Vatca <dan.vatca@gmail.com>

illumos/illumos-gate@b289d045e084af53efcc025255af8242e41f28fa

8 years ago6529 Properly handle updates of variably-sized SA entries.
Alexander Motin [Tue, 26 Jan 2016 13:49:46 +0000 (13:49 +0000)]
6529 Properly handle updates of variably-sized SA entries.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Ned Bass <bass6@llnl.gov>
Reviewed by: Tim Chase <tim@chase2k.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Andriy Gapon <avg@icyb.net.ua>

illumos/illumos-gate@e7e978b1f75353cb29673af9b35453c20c2827bf

During the update process in sa_modify_attrs(), the sizes of existing
variably-sized SA entries are obtained from sa_lengths[]. The case where
a variably-sized SA was being replaced neglected to increment the index
into sa_lengths[], so subsequent variable-length SAs would be rewritten
with the wrong length. This patch adds the missing increment operation
so all variably-sized SA entries are stored with their correct lengths.

Another problem was that index into attr_desc[] was increased even when
an attribute was removed. If that attribute was not the last attribute,
then the last attribute was lost.