1. 14 Mar, 2022 1 commit
  2. 09 Mar, 2022 1 commit
  3. 08 Mar, 2022 1 commit
    • Brian Behlendorf's avatar
      Fix ENOSPC when unlinking multiple files from full pool · 145af480
      Brian Behlendorf authored
      
      When unlinking multiple files from a pool at 100% capacity, it was
      possible for ENOSPC to be returned after the first unlink.  e.g.
      
          rm -f /mnt/fs/test1.0.0 /mnt/fs/test1.1.0 /mnt/fs/test1.2.0
          rm: cannot remove '/mnt/fs/test1.1.0': No space left on device
          rm: cannot remove '/mnt/fs/test1.2.0': No space left on device
      
      After waiting for the pending deferred frees from the first unlink to
      be processed the remaining files can then be unlinked.  This is caused
      by the quota limit in dsl_dir_tempreserve_impl() being temporarily
      decreased to the allocatable pool capacity less any deferred free
      space.
      
      This is resolved using the existing mechanism of returning ERESTART
      when over quota as long as we know enough space will shortly be
      available after processing the pending deferred frees.
      Reviewed-by: default avatarAlexander Motin <mav@FreeBSD.org>
      Reviewed-by: default avatarRyan Moeller <freqlabs@FreeBSD.org>
      Reviewed-by: default avatarTony Hutter <hutter2@llnl.gov>
      Signed-off-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Closes #13172
      145af480
  4. 07 Mar, 2022 1 commit
  5. 04 Mar, 2022 2 commits
    • Mark Johnston's avatar
      zfs: Fix a deadlock between page busy and the teardown lock · b3427b18
      Mark Johnston authored
      When rolling back a dataset, ZFS has to purge file data resident in the
      system page cache.  To do this, it loops over all vnodes for the
      mountpoint and calls vn_pages_remove() to purge pages associated with
      the vnode's VM object.  Each page is thus exclusively busied while the
      dataset's teardown write lock is held.
      
      When handling a page fault on a mapped ZFS file, FreeBSD's page fault
      handler busies newly allocated pages and then uses VOP_GETPAGES to fill
      them.  The ZFS getpages VOP acquires the teardown read lock with vnode
      pages already busied.  This represents a lock order reversal which can
      lead to deadlock.
      
      To break the deadlock, observe that zfs_rezget() need only purge those
      pages marked valid, and that pages busied by the page fault handler are,
      by definition, invalid.  Furthermore, ZFS pages always transition from
      invalid to valid with the teardown lock held, and ZFS never creates
      partially valid pages.  Thus, zfs_rezget() can use the new
      vn_pages_remove_valid() to skip over pages busied by the fault handler.
      
      PR:		258208
      Tested by:	pho
      Reviewed by:	avg, sef, kib
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D32931
      
      Reviewed-by: default avatarTony Hutter <hutter2@llnl.gov>
      Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Reviewed-by: default avatarAlexander Motin <mav@FreeBSD.org>
      Signed-off-by: default avatarRyan Moeller <freqlabs@FreeBSD.org>
      Closes #12828
      b3427b18
    • Alexander Motin's avatar
      Really zero the zero page · 0e2bb1a3
      Alexander Motin authored
      
      While switching abd_zero_buf allocation KPI I've missed the fact
      that kmem_zalloc() zeroed the allocation, while kmem_cache_alloc()
      does not.  Add explicit bzero() after it.
      
      I don't think it should have caused real problems, but leaking one
      memory page content all over the pool is not good.
      Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Reviewed-by: default avatarBrian Atkinson <batkinson@lanl.gov>
      Reviewed-by: default avatarRyan Moeller <ryan@ixsystems.com>
      Signed-off-by: default avatarAlexander Motin <mav@FreeBSD.org>
      Closes #12569
      0e2bb1a3
  6. 02 Mar, 2022 2 commits
    • Brian Behlendorf's avatar
      ZTS: Fix import_devices_missing.ksh · 037434e4
      Brian Behlendorf authored
      Related to commit 90b77a03
      
      .  Retry the `zpool export` if the pool
      is "busy" indicating there is a process accessing the mount point.
      This can happen after an import, allowing it to be retried will
      avoid spurious test failures.
      Reviewed-by: default avatarTony Hutter <hutter2@llnl.gov>
      Signed-off-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Closes #13169
      037434e4
    • Brian Behlendorf's avatar
      ZTS: Retry in import_rewind_config_changed.ksh · 190516f0
      Brian Behlendorf authored
      
      As explained by the disclaimer in the test case,
      
          "This test can fail since nothing guarantees that old
          MOS blocks aren't overwritten."
      
      This behavior is expected and correct, but results in a
      flaky test case which is problematic for the CI.  The best
      we can do to resolve this is to retry the sub-test which
      failed when the MOS blocks have clearly been overwritten.
      
      When testing failures were rare enough that a single retry
      should normally be sufficient.  However, we allow up to
      five for good measure.
      
      Reviewed by: George Melikov <mail@gmelikov.ru>
      Signed-off-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Closes #13119
      190516f0
  7. 01 Mar, 2022 3 commits
  8. 16 Feb, 2022 2 commits
    • наб's avatar
      Fix FreeBSD reporting on reruns · f2eaa978
      наб authored
      Turns out, when your test-suite fails on FreeBSD the rerun logic
      would fail as follows:
      
      Results Summary
      PASS	 1358
      FAIL	   7
      SKIP	  47
      
      Running Time:	04:00:02
      Percent passed:	96.2%
      Log directory:	/var/tmp/test_results/20220225T092538
      mktemp: illegal option -- p
      usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
             mktemp [-d] [-q] [-u] -t prefix
      mktemp: illegal option -- p
      usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
             mktemp [-d] [-q] [-u] -t prefix
      /usr/local/share/zfs/zfs-tests.sh: cannot create :
                                         No such file or directory
      ...
      
      This change resolves a flaw from the original commit, 2320e6eb
      
      
      ("Add zfs-test  facility to automatically rerun failing tests")
      
      Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
      Signed-off-by: default avatarAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
      Closes #13156 
      f2eaa978
    • Paul Dagnelie's avatar
      Fix cpu hotplug atomic sleep issue · 7bd292e5
      Paul Dagnelie authored
      
      We move the spinlock unlock before the thread creation. This should be
      safe because the thread creation code doesn't actually manipulate any
      taskq data structures; that's done by the thread once it's created.
      
      We also remove the assertion that the maxthreads is the current threads
      plus one; that assertion could fail if multiple hotplug events come in
      quick succession, and the first new taskq thread hasn't had a chance to
      start processing yet.
      Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Reviewed-by: default avatarMatthew Ahrens <mahrens@delphix.com>
      eviewed-by: default avatarTony Nguyen <tony.nguyen@delphix.com>
      Signed-off-by: default avatarPaul Dagnelie <pcd@delphix.com>
      Closes #12714
      7bd292e5
  9. 24 Feb, 2022 5 commits
    • Damian Szuberski's avatar
      Fix directory detection in `dkms.mkconf` · 5c80a256
      Damian Szuberski authored
      
      Fix `zfs-dkms` installation on Debian-derived distributions by
      aligning the directory detection logic to #13096.
      Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Signed-off-by: default avatarszubersk <szuberskidamian@gmail.com>
      Closes #11449
      Closes #13141
      5c80a256
    • Attila Fülöp's avatar
      Linux 5.11 compat: x86 SIMD: fix kernel_fpu_{begin,end}() detection · 1d706981
      Attila Fülöp authored
      
      Linux 5.11 changed kernel_fpu_begin() to an inlined function and
      moved the functionality to kernel_fpu_begin_mask(). This breaks the
      existing detection mechanism since it checks if kernel_fpu_begin is
      an exported kernel symbol, which isn't the case for an inlined
      function.
      
      To avoid assumptions about internal implementation, replace
      ZFS_LINUX_TEST_RESULT_SYMBOL in favor of  ZFS_LINUX_TEST_RESULT
      which already makes sure kernel_fpu_{begin,end}() is usable by us.
      Reviewed-by: default avatarTony Hutter <hutter2@llnl.gov>
      Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Signed-off-by: default avatarAttila Fülöp <attila@fueloep.org>
      Closes #13147
      1d706981
    • Damian Szuberski's avatar
      Fix Linux kernel directories detection · b55ed8df
      Damian Szuberski authored
      
      Most modern Linux distributions have separate locations for bare
      source and prebuilt ("build") files. Additionally, there are `source`
      and `build` symlinks in `/lib/modules/$(KERNEL_VERSION)` pointing to
      them. The order of directory search is now:
      - `configure` command line values if both `--with-linux` and
        `--with-linux-obj` were defined
      - If only `--with-linux` was defined, `--with-linux-obj` is assumed
        to have the same value as `--with-linux`
      - If neither `--with-linux` nor `--with-linux-obj` were defined
        autodetection is used:
        - `/lib/modules/$(uname -r)/{source,build}` respectively, if exist
        - The first directory in `/lib/modules` with the highest version
          number according to `sort -V` which contains `source` and `build`
          symlinks/directories
        - The first directory matching `/usr/src/kernels/*` and
          `/usr/src/linux-*` with the highest version number according to
          `sort -V`. Here the source and prebuilt directories are assumed
          to be the same.
      Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Signed-off-by: default avatarszubersk <szuberskidamian@gmail.com>
      Closes #9935
      Closes #13096 
      b55ed8df
    • George Amanakis's avatar
      Enable encrypted raw sending to pools with greater ashift · bcddb18b
      George Amanakis authored
      
      Raw sending from pool1/encrypted with ashift=9 to pool2/encrypted with
      ashift=12 results to failure when mounting pool2/encrypted (Input/Output
      error). Notably, the opposite, raw sending from a greater ashift to a
      lower one does not fail.
      
      This happens because zio_compress_write() falsely checks only
      ZIO_FLAG_RAW_COMPRESS and not ZIO_FLAG_RAW_ENCRYPT which is also set in
      encrypted raw send streams. In this case it rounds up the psize and if
      not equal to the zio->io_size it modifies the block by zeroing out
      the extra bytes. Because this happens in a SA attr. registration object
      (type=46), the decryption fails upon mounting the filesystem, and zpool
      status falsely reports an error.
      
      Fix this by checking both ZIO_FLAG_RAW_COMPRESS and ZIO_FLAG_RAW_ENCRYPT
      before deciding whether to zero-pad a block.
      Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Signed-off-by: default avatarGeorge Amanakis <gamanakis@gmail.com>
      Closes #13067 
      Closes #13074 
      bcddb18b
    • George Amanakis's avatar
      Avoid dirtying the final TXGs when exporting a pool · 6c6153e5
      George Amanakis authored
      
      There are two codepaths than can dirty final TXGs:
      
      1) If calling spa_export_common()->spa_unload()->
         spa_unload_log_sm_flush_all() after the spa_final_txg is set, then
         spa_sync()->spa_flush_metaslabs() may end up dirtying the final
         TXGs. Then we have the following panic:
         Call Trace:
          <TASK>
          dump_stack_lvl+0x46/0x62
          spl_panic+0xea/0x102 [spl]
          dbuf_dirty+0xcd6/0x11b0 [zfs]
          zap_lockdir_impl+0x321/0x590 [zfs]
          zap_lockdir+0xed/0x150 [zfs]
          zap_update+0x69/0x250 [zfs]
          feature_sync+0x5f/0x190 [zfs]
          space_map_alloc+0x83/0xc0 [zfs]
          spa_generate_syncing_log_sm+0x10b/0x2f0 [zfs]
          spa_flush_metaslabs+0xb2/0x350 [zfs]
          spa_sync_iterate_to_convergence+0x15a/0x320 [zfs]
          spa_sync+0x2e0/0x840 [zfs]
          txg_sync_thread+0x2b1/0x3f0 [zfs]
          thread_generic_wrapper+0x62/0xa0 [spl]
          kthread+0x127/0x150
          ret_from_fork+0x22/0x30
          </TASK>
      
      2) Calling vdev_*_stop_all() for a second time in spa_unload() after
         spa_export_common() unnecessarily delays the final TXGs beyond what
         spa_final_txg is set at.
      
      Fix this by performing the check and call for
      spa_unload_log_sm_flush_all() before the spa_final_txg is set in
      spa_export_common(). Also check if the spa_final_txg has already been
      set in spa_unload() and skip those calls in this case.
      Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
      Signed-off-by: default avatarGeorge Amanakis <gamanakis@gmail.com>
      External-issue: https://www.illumos.org/issues/9081
      Closes #13048 
      Closes #13098 
      6c6153e5
  10. 17 Feb, 2022 22 commits