Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[RFC] ZFS 0.6.5.8 proposed patch stack #5025

Merged
merged 46 commits into from
Sep 9, 2016

Commits on Sep 5, 2016

  1. Fixes bug in fix_paths()

    Fixes bug introduced in commit 7d90f569a.  Hinted by gcc:
    
    libzfs_import.c: In function ‘fix_paths’:
    libzfs_import.c:602:28: warning: self-comparison always evaluates to true [-Wtautological-compare]
        if (best->ne_num_labels == best->ne_num_labels &&
    
    Signed-off-by: Marcel Huber <marcelhuberfoo@gmail.com>
    Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Issue openzfs#4632
    marcelhuberfoo authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    9a6fcfd View commit details
    Browse the repository at this point in the history
  2. Add make lint target

    Add a `make lint` target which maps to a cppcheck target.  As with
    the shellcheck target it will only run when cppcheck is installed.
    This allows a `make lint` build check to be incrementally added to
    the automated testing for distribution which provide cppcheck.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4915
    behlendorf authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    2aec0bf View commit details
    Browse the repository at this point in the history
  3. Obey arc_meta_limit default size when changing arc_max

    When decreasing the maximum ARC size preserve the 3/4 default
    ratio for the arc_meta_limit.  Otherwise, the arc_meta_limit
    may be set the same as arc_max.
    
    Signed-off-by: AndCycle <andcycle@andcycle.idv.tw>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4001
    AndCycle authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    347cdb6 View commit details
    Browse the repository at this point in the history
  4. Fix ztest truncated cache file

    Commit efc412b updated spa_config_write() for Linux 4.2 kernels to
    truncate and overwrite rather than rename the cache file.  This is
    the correct fix but it should have only been applied for the kernel
    build.  In user space rename(2) is needed because ztest depends on
    the cache file.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4129
    behlendorf authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    efde194 View commit details
    Browse the repository at this point in the history
  5. Illumos 4953, 4954, 4955

    4953 zfs rename <snapshot> need not involve libshare
    4954 "zfs create" need not involve libshare if we are not sharing
    4955 libshare's get_zfs_dataset need not sort the datasets
    Reviewed by: George Wilson <george.wilson@delphix.com>
    Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
    Reviewed by: Dan McDonald <danmcd@omniti.com>
    Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
    Approved by: Garrett D'Amore <garrett@damore.org>
    
    References:
      https://www.illumos.org/issues/4953
      https://www.illumos.org/issues/4954
      https://www.illumos.org/issues/4955
      illumos/illumos-gate@33cde0d
    
    Porting notes:
    - Dropped qsort libshare_zfs.c hunk, no equivalent ZoL code.
    
    Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4219
    ahrens authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    2ea36ad View commit details
    Browse the repository at this point in the history
  6. Remove dummy znode from zvol_state

    struct zvol_state contains a dummy znode, which is around 1KB on x64,
    only for zfs_range_lock. But in reality, other than z_range_lock and
    z_range_avl, zfs_range_lock only need znode on regular file, which
    means we add 1KB on a structure and gain nothing.
    
    In this patch, we remove the dummy znode for zvol_state. In order to
    do that, we also need to refactor zfs_range_lock a bit. We move
    z_range_lock and z_range_avl pair out of znode_t to form zfs_rlock_t.
    This new struct replaces znode_t as the main handle inside the range
    lock functions.
    
    We also add pointers to z_size, z_blksz, and z_max_blksz so range lock
    code doesn't depend on znode_t.  This allows non-ZPL consumers like
    Lustre to use the range locks with their equivalent znode_t structure.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Boris Protopopov <boris.protopopov@actifio.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4510
    Chunwei Chen authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    703c9f5 View commit details
    Browse the repository at this point in the history
  7. Linux 4.7 compat: handler->get() takes both dentry and inode

    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Issue openzfs#4665
    Chunwei Chen authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    55b8857 View commit details
    Browse the repository at this point in the history
  8. Linux 4.7 compat: replace blk_queue_flush with blk_queue_write_cache

    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Issue openzfs#4665
    Chunwei Chen authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    1aff4bb View commit details
    Browse the repository at this point in the history
  9. Linux 4.7 compat: use iterate_shared for concurrent readdir

    Register iterate_shared if it exists so the kernel will used shared
    lock and allowing concurrent readdir.
    
    Also, use shared lock when doing llseek with SEEK_DATA or SEEK_HOLE
    to allow concurrent seeking.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4664
    Closes openzfs#4665
    Chunwei Chen authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    7043281 View commit details
    Browse the repository at this point in the history
  10. Linux 4.7 compat: handler->set() takes both dentry and inode

    Counterpart to fd4c7b7, the same approach was taken to resolve
    the compatibility issue.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Closes openzfs#4717
    Issue openzfs#4665
    behlendorf authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    01d9981 View commit details
    Browse the repository at this point in the history
  11. Retire HAVE_CURRENT_UMASK and HAVE_POSIX_ACL_CACHING

    Remove ZFS_AC_KERNEL_CURRENT_UMASK and ZFS_AC_KERNEL_POSIX_ACL_CACHING
    configure checks, all supported kernel provide this functionality.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Closes openzfs#4922
    behlendorf authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    97a1bbd View commit details
    Browse the repository at this point in the history
  12. Linux 4.7 compat: fix zpl_get_acl returns invalid acl pointer

    Starting from Linux 4.7, get_acl will set acl cache pointer to temporary
    sentinel value before calling i_op->get_acl. Therefore we can't compare
    against ACL_NOT_CACHED and return.
    
    Since from Linux 3.14, get_acl already check the cache for us, so we
    disable this in zpl_get_acl.
    
    Linux 4.7 also does set_cached_acl for us so we disable it in zpl_get_acl.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4944
    Closes openzfs#4946
    Chunwei Chen authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    26e2bfa View commit details
    Browse the repository at this point in the history
  13. Skip ctldir znode in zfs_rezget to fix snapdir issues

    Skip ctldir in zfs_rezget, otherwise they will always get invalidated. This
    will cause funny behaviour for the mounted snapdirs. Especially for
    Linux >= 3.18, d_invalidate will detach the mountpoint and prevent anyone
    automount it again as long as someone is still using the detached mount.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4514
    Closes openzfs#4661
    Closes openzfs#4672
    Chunwei Chen authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    f3f0c58 View commit details
    Browse the repository at this point in the history
  14. Rename 'zed.service' to 'zfs-zed.service'

    For consistency all systemd unit files and init scripts now share
    the same names.  This prevents an issue where the zed is started
    twice on systems where both the systemd and sysv infrastructure is
    installed concurrently.
    
    For backward compatibility a 'zed' alias has been added.  This
    allows the user to interact with the service using either the
    name 'zed' or 'zfs-zed'.
    
    Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Issue openzfs#3837
    FransUrbo authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    1db6030 View commit details
    Browse the repository at this point in the history
  15. Add nfs-kernel-server for Debian

    Debian based systems use nfs-kernel-server as the service name.
    List both nfs-server.service and nfs-kernel-server.service so
    this service will work on multiple distributions.
    
    Signed-off-by: Grischa Zengel <github.zfsonlinux@zengel.info>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4350
    ggzengel authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    ff2a2b2 View commit details
    Browse the repository at this point in the history
  16. Systemd configuration fixes

    * Disable zfs-import-scan.service by default.  This ensures that
    pools will not be automatically imported unless they appear in
    the cache file.  When this service is explicitly enabled pools
    will be imported with the "cachefile=none" property set.  This
    prevents the creation of, or update to, an existing cache file.
    
        $ systemctl list-unit-files | grep zfs
        zfs-import-cache.service                  enabled
        zfs-import-scan.service                   disabled
        zfs-mount.service                         enabled
        zfs-share.service                         enabled
        zfs-zed.service                           enabled
        zfs.target                                enabled
    
    * Change services to dynamic from static by adding an [Install]
    section and adding 'WantedBy' tags in favor of 'Requires' tags.
    This allows for easier customization of the boot behavior.
    
    * Start the zfs-import-cache.service after the root pivot so
    the cache file is available in the standard location.
    
    * Start the zfs-mount.service after the systemd-remount-fs.service
    to ensure the root fs is writeable and the ZFS filesystems can
    create their mount points.
    
    * Change the default behavior to only load the ZFS kernel modules
    in zfs-import-*.service or when blkid(8) detects a pool.  Users
    who wish to unconditionally load the kernel modules must uncomment
    the list of modules in /lib/modules-load.d/zfs.conf.
    
    Reviewed-by: Richard Laager <rlaager@wiktel.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4325
    Closes openzfs#4496
    Closes openzfs#4658
    Closes openzfs#4699
    behlendorf authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    6ae855d View commit details
    Browse the repository at this point in the history
  17. Linux 4.6 compat: Fall back to d_prune_aliases() if necessary

    As of 4.6, the icache and dcache LRUs are memcg aware insofar as the
    kernel's per-superblock shrinker is concerned.  The effect is that dcache
    or icache entries added by a task in a non-root memcg won't be scanned
    by the shrinker in the context of the root (or NULL) memcg.  This defeats
    the attempts by zfs_sb_prune() to unpin buffers and can allow metadata to
    grow uncontrollably.  This patch reverts to the d_prune_aliaes() method
    in case the kernel's per-superblock shrinker is not able to free anything.
    
    Signed-off-by: Tim Chase <tim@chase2k.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
    Closes: openzfs#4726
    dweeezil authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    db3f5ed View commit details
    Browse the repository at this point in the history
  18. Fix Large kmem_alloc in vdev_metaslab_init

    This allocation can go way over 1MB, so we should use vmem_alloc
    instead of kmem_alloc.
    
      Large kmem_alloc(1430784, 0x1000), please file an issue...
      Call Trace:
       [<ffffffffa0324aff>] ? spl_kmem_zalloc+0xef/0x160 [spl]
       [<ffffffffa17d0c8d>] ? vdev_metaslab_init+0x9d/0x1f0 [zfs]
       [<ffffffffa17d46d0>] ? vdev_load+0xc0/0xd0 [zfs]
       [<ffffffffa17d4643>] ? vdev_load+0x33/0xd0 [zfs]
       [<ffffffffa17c0004>] ? spa_load+0xfc4/0x1b60 [zfs]
       [<ffffffffa17c1838>] ? spa_tryimport+0x98/0x430 [zfs]
       [<ffffffffa17f28b1>] ? zfs_ioc_pool_tryimport+0x41/0x80 [zfs]
       [<ffffffffa17f5669>] ? zfsdev_ioctl+0x4a9/0x4e0 [zfs]
       [<ffffffff811bacdf>] ? do_vfs_ioctl+0x2cf/0x4b0
       [<ffffffff811baf41>] ? SyS_ioctl+0x81/0xa0
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4752
    Chunwei Chen authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    a77cea5 View commit details
    Browse the repository at this point in the history
  19. Fix PANIC: metaslab_free_dva(): bad DVA X:Y:Z

    The following scenario can result in garbage in the dn_spill field.
    The db->db_blkptr must be set to NULL when DNODE_FLAG_SPILL_BLKPTR
    is clear to ensure the dn_spill field is cleared.
    
    Current txg = A.
    * A new spill buffer is created. Its dbuf is initialized with
      db_blkptr = NULL and it's dirtied.
    
    Current txg = B.
    * The spill buffer is modified. It's marked as dirty in this txg.
    * Additional changes make the spill buffer unnecessary because the
      xattr fits into the bonus buffer, so it's removed. The dbuf is
      undirtied in this txg, but it's still referenced and cannot be
      destroyed.
    
    Current txg = C.
    * Starts syncing of txg A
    * dbuf_sync_leaf() is called for the spill buffer. Since db_blkptr
      is NULL, dbuf_check_blkptr() is called.
    * The dbuf starts being written and it reaches the ready state
      (not done yet).
    * A new change makes the spill buffer necessary again.
      sa_build_layouts() ends up calling dbuf_find() to locate the
      dbuf.  It finds the old dbuf because it has not been destroyed yet
      (it will be destroyed when the previous write is done and there
      are no more references). The old dbuf has db_blkptr != NULL.
    * txg A write is complete and the dbuf released. However it's still
      referenced, so it's not destroyed.
    
    Current txg = D.
    * Starts syncing of txg B
    * dbuf_sync_leaf() is called for the bonus buffer. Its contents are
      directly copied into the dnode, overwriting the blkptr area because,
      in txg B, the bonus buffer was big enough to hold the entire xattr.
    * At this point, the db_blkptr of the spill buffer used in txg C
      gets corrupted.
    
    Signed-off-by: Peng <peng.hse@xtaotech.com>
    Signed-off-by: Tim Chase <tim@chase2k.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#3937
    hsepeng authored and nedbass committed Sep 5, 2016
    Configuration menu
    Copy the full SHA
    4f96e68 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2016

  1. Add tunable to ignore hole_birth (enabled by default)

    Adds a module option which disables the hole_birth optimization
    which has been responsible for several recent bugs, including
    issue openzfs#4050.
    
    Original-patch: https://gist.github.com/pcd1193182/2c0cd47211f3aee623958b4698836c48
    Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4833
    rincebrain authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    3a8e136 View commit details
    Browse the repository at this point in the history
  2. Add ZIO_CHECKSUM_IS_ZERO

    The ZIO_CHECKSUM_IS_ZERO macro was added in master commit:
    
    37f8a88 Illumos 5746 - more checksumming in zfs send
    
    That whole patch is not suitable for the release branch
    but some other backported patches on that macro.
    
    Signed-off-by: Ned Bass <bass6@llnl.gov>
    nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    5acbedb View commit details
    Browse the repository at this point in the history
  3. xattr dir doesn't get purged during iput

    We need to set inode->i_nlink to zero so iput will purge it. Without this, it
    will get purged during shrink cache or umount, which would likely result in
    deadlock due to zfs_zget waiting forever on its children which are in the
    dispose_list of the same thread.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Chris Dunlop <chris@onthe.net.au>
    Issue openzfs#4359
    Issue openzfs#3508
    Issue openzfs#4413
    Issue openzfs#4827
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    f7923f4 View commit details
    Browse the repository at this point in the history
  4. Kill zp->z_xattr_parent to prevent pinning

    zp->z_xattr_parent will pin the parent. This will cause huge issue
    when unlink a file with xattr. Because the unlinked file is pinned, it
    will never get purged immediately. And because of that, the xattr
    stuff will never be marked as unlinked. So the whole unlinked stuff
    will stay there until shrink cache or umount.
    
    This change partially reverts e89260a.  This is safe because only the
    zp->z_xattr_parent optimization is removed, zpl_xattr_security_init()
    is still called from the zpl outside the inode lock.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Chris Dunlop <chris@onthe.net.au>
    Issue openzfs#4359
    Issue openzfs#3508
    Issue openzfs#4413
    Issue openzfs#4827
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    ec9b8fa View commit details
    Browse the repository at this point in the history
  5. Fix get_zfs_sb race with concurrent umount

    Certain ioctl operations will call get_zfs_sb, which will holds an active
    count on sb without checking whether it's active or not. This will result
    in use-after-free. We fix this by using atomic_inc_not_zero to make sure
    we got an active sb.
    
    P1                                          P2
    ---                                         ---
    deactivate_locked_super(): s_active = 0
                                                zfs_sb_hold()
                                                ->get_zfs_sb(): s_active = 1
    ->zpl_kill_sb()
    -->zpl_put_super()
    --->zfs_umount()
    ---->zfs_sb_free(zsb)
                                                zfs_sb_rele(zsb)
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    d5b0e7f View commit details
    Browse the repository at this point in the history
  6. Fix arc_prune_task use-after-free

    arc_prune_task uses a refcount to protect arc_prune_t, but it doesn't prevent
    the underlying zsb from disappearing if there's a concurrent umount. We fix
    this by force the caller of arc_remove_prune_callback to wait for
    arc_prune_taskq to finish.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4687
    Closes openzfs#4690
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    9f5f758 View commit details
    Browse the repository at this point in the history
  7. Fix memleak in zpl_parse_options

    strsep() will advance tmp_mntopts, and will change it to NULL on last
    iteration.  This will cause strfree(tmp_mntopts) to not free anything.
    
    unreferenced object 0xffff8800883976c0 (size 64):
      comm "mount.zfs", pid 3361, jiffies 4294931877 (age 1482.408s)
      hex dump (first 32 bytes):
        72 77 00 73 74 72 69 63 74 61 74 69 6d 65 00 7a  rw.strictatime.z
        66 73 75 74 69 6c 00 6d 6e 74 70 6f 69 6e 74 3d  fsutil.mntpoint=
      backtrace:
        [<ffffffff81810c4e>] kmemleak_alloc+0x4e/0xb0
        [<ffffffff811f9cac>] __kmalloc+0x16c/0x250
        [<ffffffffc065ce9b>] strdup+0x3b/0x60 [spl]
        [<ffffffffc080fad6>] zpl_parse_options+0x56/0x300 [zfs]
        [<ffffffffc080fe46>] zpl_mount+0x36/0x80 [zfs]
        [<ffffffff81222dc8>] mount_fs+0x38/0x160
        [<ffffffff81240097>] vfs_kern_mount+0x67/0x110
        [<ffffffff812428e0>] do_mount+0x250/0xe20
        [<ffffffff812437d5>] SyS_mount+0x95/0xe0
        [<ffffffff8181aff6>] entry_SYSCALL_64_fastpath+0x1e/0xa8
        [<ffffffffffffffff>] 0xffffffffffffffff
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Tony Hutter <hutter2@llnl.gov>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4706
    Issue openzfs#4708
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    3602878 View commit details
    Browse the repository at this point in the history
  8. Fix out-of-bound access in zfs_fillpage

    The original code will do an out-of-bound access on pl[] during last
    iteration.
    
     ==================================================================
     BUG: KASAN: stack-out-of-bounds in zfs_getpage+0x14c/0x2d0 [zfs]
     Read of size 8 by task tmpfile/7850
     page:ffffea00017c6dc0 count:0 mapcount:0 mapping:          (null) index:0x0
     flags: 0xffff8000000000()
     page dumped because: kasan: bad access detected
     CPU: 3 PID: 7850 Comm: tmpfile Tainted: G           OE   4.6.0+ openzfs#3
      ffff88005f1b7678 0000000006dbe035 ffff88005f1b7508 ffffffff81635618
      ffff88005f1b7678 ffff88005f1b75a0 ffff88005f1b7590 ffffffff81313ee8
      ffffea0001ae8dd0 ffff88005f1b7670 0000000000000246 0000000041b58ab3
     Call Trace:
      [<ffffffff81635618>] dump_stack+0x63/0x8b
      [<ffffffff81313ee8>] kasan_report_error+0x528/0x560
      [<ffffffff81278f20>] ? filemap_map_pages+0x5f0/0x5f0
      [<ffffffff813144b8>] kasan_report+0x58/0x60
      [<ffffffffc12250dc>] ? zfs_getpage+0x14c/0x2d0 [zfs]
      [<ffffffff81312e4e>] __asan_load8+0x5e/0x70
      [<ffffffffc12250dc>] zfs_getpage+0x14c/0x2d0 [zfs]
      [<ffffffffc1252131>] zpl_readpage+0xd1/0x180 [zfs]
    
      [<ffffffff81353c3a>] SyS_execve+0x3a/0x50
      [<ffffffff810058ef>] do_syscall_64+0xef/0x180
      [<ffffffff81d0ee25>] entry_SYSCALL64_slow_path+0x25/0x25
     Memory state around the buggy address:
      ffff88005f1b7500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      ffff88005f1b7580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     >ffff88005f1b7600: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 f4
                                                                     ^
      ffff88005f1b7680: f4 f4 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00
      ffff88005f1b7700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ==================================================================
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Tony Hutter <hutter2@llnl.gov>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4705
    Issue openzfs#4708
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    af4e507 View commit details
    Browse the repository at this point in the history
  9. Don't allow accessing XATTR via export handle

    Allow accessing XATTR through export handle is a very bad idea. It
    would allow user to write whatever they want in fields where they
    otherwise could not.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Issue openzfs#4828
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    2ab9247 View commit details
    Browse the repository at this point in the history
  10. fh_to_dentry should return ESTALE when generation mismatch

    When generation mismatch, it usually means the file pointed by the file handle
    was deleted. We should return ESTALE to indicate this. We return ENOENT in
    zfs_vget since zpl_fh_to_dentry will convert it to ESTALE.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Issue openzfs#4828
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    91f81c4 View commit details
    Browse the repository at this point in the history
  11. Prevent null dereferences when accessing dbuf kstat

    In arc_buf_info(), the arc_buf_t may have no header.  If not, don't try
    to fetch the arc buffer stats and instead just zero them.
    
    The null dereferences were observed while accessing the dbuf kstat with
    awk on a system in which millions of small files were being created in
    order to overflow the system's metadata limit.
    
    Signed-off-by: Tim Chase <tim@chase2k.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Closes openzfs#4837
    dweeezil authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    e871059 View commit details
    Browse the repository at this point in the history
  12. Fix dbuf_stats_hash_table_data race

    Dropping DBUF_HASH_MUTEX when walking the hash list is unsafe. The dbuf
    can be freed at any time.
    
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4846
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    58000c3 View commit details
    Browse the repository at this point in the history
  13. OpenZFS 7263 - deeply nested nvlist can overflow stack

    nvlist_pack() and nvlist_unpack are implemented recursively, which can
    cause the stack to overflow with a deeply nested nvlist; i.e. an nvlist
    which contains an nvlist, which contains an nvlist, which...
    
    Unprivileged users can pass an nvlist to the kernel via certain ioctls
    on /dev/zfs, which the kernel will unpack without additional permission
    checking or validation. Therefore, an unprivileged user can cause the
    kernel's stack to overflow and panic.
    
    Ideally, these functions would be implemented non-recursively. As a
    quick fix, this patch limits the depth of the recursion and returns an
    error when attempting to pack and unpack a deeply-nested nvlist.
    
    Signed-off-by: Adam Leventhal <ahl@delphix.com>
    Signed-off-by: George Wilson <george.wilson@delphix.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Ported-by: Prakash Surya <prakash.surya@delphix.com>
    
    OpenZFS-issue: https://www.illumos.org/issues/7263
    OpenZFS-commit: openzfs/openzfs@0511d6d
    
    -
    ahrens authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    1421562 View commit details
    Browse the repository at this point in the history
  14. OpenZFS 6876 - Stack corruption after importing a pool with a too-lon…

    …g name
    
    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>
    Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
    
    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.
    
    OpenZFS-issue: https://www.illumos.org/issues/6876
    OpenZFS-commit: openzfs/openzfs@ca8674e
    pcd1193182 authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    d9e1eec View commit details
    Browse the repository at this point in the history
  15. Fix self-healing IO prior to dsl_pool_init() completion

    Async writes triggered by a self-healing IO may be issued before the
    pool finishes the process of initialization.  This results in a NULL
    dereference of `spa->spa_dsl_pool` in vdev_queue_max_async_writes().
    
    George Wilson recommended addressing this issue by initializing the
    passed `dsl_pool_t **` prior to dmu_objset_open_impl().  Since the
    caller is passing the `spa->spa_dsl_pool` this has the effect of
    ensuring it's initialized.
    
    However, since this depends on the caller knowing they must pass
    the `spa->spa_dsl_pool` an additional NULL check was added to
    vdev_queue_max_async_writes().  This guards against any future
    restructuring of the code which might result in dsl_pool_init()
    being called differently.
    
    Signed-off-by: GeLiXin <47034221@qq.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4652
    GeLiXin authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    74acdfc View commit details
    Browse the repository at this point in the history
  16. Fix incorrect pool state after import

    Import a raidz pool which has a vdev with a bad label, zpool status
    shows the right state of the dev, but the wrong state of the pool.
    The pool state should be DEGRADED, not ONLINE.
    
    We examine the label in vdev_validate while in spa_load_impl, the bad
    label can be detected but doesn't propagate its state to the parent.
    There are other chances to propagate state in the following vdev_load
    if we failed to load DTL, but our pool is raidz1 which can tolerate a
    faulted disk.  So we lost the last chance to correct the pool state.
    
    Propagate the leaf vdev's state to parent if its label was corrupted,
    as is done elsewhere in vdev_validate.
    
    Signed-off-by: GeLiXin <ge.lixin@zte.com.cn>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Don Brady <don.brady@intel.com>
    Closes openzfs#4948
    GeLiXin authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    c236865 View commit details
    Browse the repository at this point in the history
  17. Fix call zfs_get_name() with invalid parameter

    zfs_get_name() expects a parameter of type zfs_handle_t *zhp , but
    gets an invalid parameter type of zfs_handle_t **zhp actually in
    libzfs_dataset_cmp(), which may trigger a coredump if called.
    
    libzfs_dataset_cmp() working normally so far, just because all the
    callers only give datasets of type ZFS_TYPE_FILESYSTEM to it, we
    compared their mountpoint and return, luckily.
    
    Signed-off-by: GeLiXin <ge.lixin@zte.com.cn>
    Signed-off-by: Tim Chase <tim@chase2k.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4919
    GeLiXin authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    e66b546 View commit details
    Browse the repository at this point in the history
  18. Fix: Array bounds read in zprop_print_one_property()

    If the loop index i comes to (ZFS_GET_NCOLS - 1), the cbp->cb_columns[i + 1]
    actually read the data of cbp->cb_colwidths[0], which means the array
    subscript is above array bounds.
    
    Luckily the cbp->cb_colwidths[0] is always 0 and it seems we haven't
    looped enough times to exceed the array bounds so far, but it's really
    a secluded risk someday.
    
    Signed-off-by: GeLiXin <ge.lixin@zte.com.cn>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#5003
    GeLiXin authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    e5c02cb View commit details
    Browse the repository at this point in the history
  19. FreeBSD rS271776 - Persist vdev_resilver_txg changes

    Persist vdev_resilver_txg changes to avoid panic caused by validation
    vs a vdev_resilver_txg value from a previous resilver.
    
    Authored-by: smh <smh@FreeBSD.org>
    Ported-by: Chris Dunlop <chris@onthe.net.au>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    
    OpenZFS-issue: https://www.illumos.org/issues/5154
    FreeBSD-issue: https://reviews.freebsd.org/rS271776
    FreeBSD-commit: freebsd/freebsd-src@c3c60bf
    Closes openzfs#4790
    smh authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    3d824a8 View commit details
    Browse the repository at this point in the history
  20. Linux 4.8 compat: submit_bio()

    The rw argument has been removed from submit_bio/submit_bio_wait.
    Callers are now expected to set bio->bi_rw instead of passing it
    in.  See torvalds/linux@4e49ea4a for
    complete details.
    
    Signed-off-by: Tim Chase <tim@chase2k.com>
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Issue openzfs#4892
    Issue openzfs#4899
    behlendorf authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    68b8d22 View commit details
    Browse the repository at this point in the history
  21. Linux 4.8 compat: REQ_PREFLUSH

    The REQ_FLUSH flag was renamed REQ_PREFLUSH to avoid confusion with
    REQ_OP_FLUSH.  See torvalds/linux@28a8f0d3
    for complete details.
    
    Signed-off-by: Tim Chase <tim@chase2k.com>
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Issue openzfs#4892
    Issue openzfs#4899
    behlendorf authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    a0591c4 View commit details
    Browse the repository at this point in the history
  22. Linux 4.8 compat: REQ_OP and bio_set_op_attrs()

    New REQ_OP_* definitions have been introduced to separate the
    WRITE, READ, and DISCARD operations from the flags.  This included
    changing the encoding of bi_rw.  It places REQ_OP_* in high order
    bits and other stuff in low order bits.  This encoding is done
    through the new helper function bio_set_op_attrs.  For complete
    details refer to:
    
    torvalds/linux@f215082
    torvalds/linux@4e1b2d5
    
    Signed-off-by: Tim Chase <tim@chase2k.com>
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4892
    Closes openzfs#4899
    Chunwei Chen authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    6ae0dbd View commit details
    Browse the repository at this point in the history
  23. Linux 4.8 compat: posix_acl_valid()

    The posix_acl_valid() function has been updated to require a
    user namespace.  Filesystem callers should normally provide the
    user_ns from the super block associcated with the ACL; the
    zpl_posix_acl_valid() wrapper has been added for this purpose.
    See torvalds/linux@0d4d717f for
    complete details.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Closes openzfs#4922
    behlendorf authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    39a78fe View commit details
    Browse the repository at this point in the history
  24. Linux 4.8 compat: Fix removal of bio->bi_rw member

    All users of bio->bi_rw have been replaced with compatibility wrappers.
    This allows the kernel specific logic to be abstracted away, and for
    each of the supported cases to be documented with the wrapper.  The
    updated interfaces are as follows:
    
    * void blk_queue_set_write_cache(struct request_queue *, bool, bool)
    * boolean_t bio_is_flush(struct bio *)
    * boolean_t bio_is_fua(struct bio *)
    * boolean_t bio_is_discard(struct bio *)
    * boolean_t bio_is_secure_erase(struct bio *)
    * VDEV_WRITE_FLUSH_FUA
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
    Closes openzfs#4951
    behlendorf authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    bf8b4a9 View commit details
    Browse the repository at this point in the history
  25. Handle block pointers with a corrupt logical size

    Commit 5f6d0b6 was originally added to gracefully handle block
    pointers with a damaged logical size.  However, it incorrectly
    assumed that all passed arc_done_func_t could handle a NULL
    arc_buf_t.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#4069
    Closes openzfs#4080
    behlendorf authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    8fe1fb1 View commit details
    Browse the repository at this point in the history
  26. Fix gcc -Warray-bounds check for dump_object() in zdb

    As of gcc 6.1.1 20160621 (Red Hat 6.1.1-3) an array bounds warnings
    is detected in the zdb the dump_object() function.  The analysis is
    correct but difficult to interpret because this is implemented as a
    macro.  Rework the ZDB_OT_NAME in to a function and remove the case
    detected by gcc which is a side effect of the DMU_OT_IS_VALID() macro.
    
      zdb.c: In function ‘dump_object’:
      zdb.c:1931:288: error: array subscript is outside array bounds
          [-Werror=array-bounds]
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Gvozden Neskovic <neskovic@gmail.com>
    Closes openzfs#4907
    behlendorf authored and nedbass committed Sep 9, 2016
    Configuration menu
    Copy the full SHA
    ffddb4d View commit details
    Browse the repository at this point in the history
  27. Prepare to release 0.6.5.8

    META file and RPM release log updated.
    
    Signed-off-by: Ned Bass <bass6@llnl.gov>
    nedbass committed Sep 9, 2016
    3 Configuration menu
    Copy the full SHA
    1f734a6 View commit details
    Browse the repository at this point in the history