Print this page
NEX-3562 filename normalization doesn't work for removes (sync with upstream)
NEX-8972 Async-delete side-effect that may cause unmount EBUSY
Reviewed by: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-8466 Failed to do 'pkg update' because of beadm failed to create BE, because of EBUSY in umount
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-5108 make deletes interruptible on pool export
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-5036 case-insensitive matching is not working on casesensitivity=mixed, normalization=none FS
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3562 filename normalization doesn't work for removes
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-4290 'insensitive' case sensitivity is broken
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3762 Appliance crashes with a NULL pointer dereference during a zpool export when a zfs_vn_rele_taskq thread attempts to check a bogus rwlock from rw_write_held
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
6328 Fix cstyle errors in zfs codebase (fix studio)
6328 Fix cstyle errors in zfs codebase
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Jorgen Lundman <lundman@lundman.net>
Approved by: Robert Mustacchi <rm@joyent.com>
NEX-3329 libnsl: set_up_connection() over TCP does not adhere the specified timeout
Reviewed by: Dan Fields <dan.fields@nexenta.com>
NEX-3521 CLONE - Port NEX-3209 normalization=formD and casesensitivity=mixed behaves improperly, squashing case
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
NEX-2965 4.0.3-FP2: deferred deletes causing RSF import failure during fail-over of service
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
SUP-780 zfs with casesensitivity=mixed and Unicode normalization doesn't normalize properly/fully

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_dir.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_dir.c
↓ open down ↓ 44 lines elided ↑ open up ↑
  45   45  #include <sys/unistd.h>
  46   46  #include <sys/sunddi.h>
  47   47  #include <sys/random.h>
  48   48  #include <sys/policy.h>
  49   49  #include <sys/zfs_dir.h>
  50   50  #include <sys/zfs_acl.h>
  51   51  #include <sys/fs/zfs.h>
  52   52  #include "fs/fs_subr.h"
  53   53  #include <sys/zap.h>
  54   54  #include <sys/dmu.h>
       55 +#include <sys/dmu_objset.h>
  55   56  #include <sys/atomic.h>
  56   57  #include <sys/zfs_ctldir.h>
  57   58  #include <sys/zfs_fuid.h>
  58   59  #include <sys/sa.h>
  59   60  #include <sys/zfs_sa.h>
  60   61  #include <sys/dnlc.h>
  61   62  #include <sys/extdirent.h>
  62   63  
  63   64  /*
  64   65   * zfs_match_find() is used by zfs_dirent_lock() to peform zap lookups
↓ open down ↓ 408 lines elided ↑ open up ↑
 473  474          ASSERT(zp->z_links == 0);
 474  475  
 475  476          VERIFY3U(0, ==,
 476  477              zap_add_int(zfsvfs->z_os, zfsvfs->z_unlinkedobj, zp->z_id, tx));
 477  478  }
 478  479  
 479  480  /*
 480  481   * Clean up any znodes that had no links when we either crashed or
 481  482   * (force) umounted the file system.
 482  483   */
 483      -void
 484      -zfs_unlinked_drain(zfsvfs_t *zfsvfs)
      484 +static void
      485 +zfs_unlinked_drain_impl(zfsvfs_t *zfsvfs)
 485  486  {
 486  487          zap_cursor_t    zc;
 487  488          zap_attribute_t zap;
 488  489          dmu_object_info_t doi;
 489  490          znode_t         *zp;
 490  491          int             error;
 491  492  
      493 +        ASSERT(zfsvfs->z_drain_state != ZFS_DRAIN_SHUTDOWN);
 492  494          /*
 493  495           * Interate over the contents of the unlinked set.
 494  496           */
 495  497          for (zap_cursor_init(&zc, zfsvfs->z_os, zfsvfs->z_unlinkedobj);
 496      -            zap_cursor_retrieve(&zc, &zap) == 0;
      498 +            zap_cursor_retrieve(&zc, &zap) == 0 &&
      499 +            /* Only checking for a shutdown request, so no locking reqd. */
      500 +            zfsvfs->z_drain_state == ZFS_DRAIN_RUNNING;
 497  501              zap_cursor_advance(&zc)) {
 498  502  
 499  503                  /*
 500  504                   * See what kind of object we have in list
 501  505                   */
 502  506  
 503  507                  error = dmu_object_info(zfsvfs->z_os,
 504  508                      zap.za_first_integer, &doi);
 505  509                  if (error != 0)
 506  510                          continue;
↓ open down ↓ 10 lines elided ↑ open up ↑
 517  521                   * We may pick up znodes that are already marked for deletion.
 518  522                   * This could happen during the purge of an extended attribute
 519  523                   * directory.  All we need to do is skip over them, since they
 520  524                   * are already in the system marked z_unlinked.
 521  525                   */
 522  526                  if (error != 0)
 523  527                          continue;
 524  528  
 525  529                  zp->z_unlinked = B_TRUE;
 526  530                  VN_RELE(ZTOV(zp));
      531 +
      532 +                ASSERT(!zfsvfs->z_unmounted);
 527  533          }
 528  534          zap_cursor_fini(&zc);
      535 +
      536 +        mutex_enter(&zfsvfs->z_drain_lock);
      537 +        zfsvfs->z_drain_state = ZFS_DRAIN_SHUTDOWN;
      538 +        cv_broadcast(&zfsvfs->z_drain_cv);
      539 +        mutex_exit(&zfsvfs->z_drain_lock);
 529  540  }
 530  541  
      542 +/*
      543 + * Setup required hold. After that tries to dispatch
      544 + * async unlinked drain logic. Otherwise executes
      545 + * the logic synchronously.
      546 + */
      547 +void
      548 +zfs_unlinked_drain(zfsvfs_t *zfsvfs)
      549 +{
      550 +        ASSERT(!zfsvfs->z_unmounted);
      551 +
      552 +        mutex_enter(&zfsvfs->z_drain_lock);
      553 +        ASSERT(zfsvfs->z_drain_state == ZFS_DRAIN_SHUTDOWN);
      554 +        zfsvfs->z_drain_state = ZFS_DRAIN_RUNNING;
      555 +        mutex_exit(&zfsvfs->z_drain_lock);
      556 +
      557 +        if (taskq_dispatch(dsl_pool_vnrele_taskq(
      558 +            spa_get_dsl(zfsvfs->z_os->os_spa)),
      559 +            (void (*)(void *))zfs_unlinked_drain_impl, zfsvfs,
      560 +            TQ_NOSLEEP) == NULL) {
      561 +                cmn_err(CE_WARN, "async zfs_unlinked_drain dispatch failed");
      562 +                zfs_unlinked_drain_impl(zfsvfs);
      563 +        }
      564 +}
      565 +
      566 +/*
      567 + * Stops an asynchronous zfs_unlinked_drain. This must be called prior to
      568 + * destroying the zfsvfs_t, as the drain doesn't hold the z_teardown_lock.
      569 + */
      570 +void
      571 +zfs_unlinked_drain_stop_wait(zfsvfs_t *zfsvfs)
      572 +{
      573 +        ASSERT(!zfsvfs->z_unmounted);
      574 +
      575 +        mutex_enter(&zfsvfs->z_drain_lock);
      576 +        while (zfsvfs->z_drain_state != ZFS_DRAIN_SHUTDOWN) {
      577 +                zfsvfs->z_drain_state = ZFS_DRAIN_SHUTDOWN_REQ;
      578 +                cv_wait(&zfsvfs->z_drain_cv, &zfsvfs->z_drain_lock);
      579 +        }
      580 +        mutex_exit(&zfsvfs->z_drain_lock);
      581 +}
      582 +
 531  583  /*
 532  584   * Delete the entire contents of a directory.  Return a count
 533  585   * of the number of entries that could not be deleted. If we encounter
 534  586   * an error, return a count of at least one so that the directory stays
 535  587   * in the unlinked set.
 536  588   *
 537  589   * NOTE: this function assumes that the directory is inactive,
 538  590   *      so there is no need to lock its entries before deletion.
 539  591   *      Also, it assumes the directory contents is *only* regular
 540  592   *      files.
↓ open down ↓ 592 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX