Print this page
5056 ZFS deadlock on db_mtx and dn_holds
Reviewed by: Will Andrews <willa@spectralogic.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h
          +++ new/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2013 by Delphix. All rights reserved.
  24   24   * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  25   25   * Copyright (c) 2013 Steven Hartland. All rights reserved.
       26 + * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  26   27   */
  27   28  
  28   29  #ifndef _SYS_DSL_DATASET_H
  29   30  #define _SYS_DSL_DATASET_H
  30   31  
  31   32  #include <sys/dmu.h>
  32   33  #include <sys/spa.h>
  33   34  #include <sys/txg.h>
  34   35  #include <sys/zio.h>
  35   36  #include <sys/bplist.h>
↓ open down ↓ 89 lines elided ↑ open up ↑
 125  126          uint64_t ds_guid;
 126  127          uint64_t ds_flags;              /* DS_FLAG_* */
 127  128          blkptr_t ds_bp;
 128  129          uint64_t ds_next_clones_obj;    /* DMU_OT_DSL_CLONES */
 129  130          uint64_t ds_props_obj;          /* DMU_OT_DSL_PROPS for snaps */
 130  131          uint64_t ds_userrefs_obj;       /* DMU_OT_USERREFS */
 131  132          uint64_t ds_pad[5]; /* pad out to 320 bytes for good measure */
 132  133  } dsl_dataset_phys_t;
 133  134  
 134  135  typedef struct dsl_dataset {
      136 +        dmu_buf_user_t ds_dbu;
      137 +
 135  138          /* Immutable: */
 136  139          struct dsl_dir *ds_dir;
 137  140          dmu_buf_t *ds_dbuf;
 138  141          uint64_t ds_object;
 139  142          uint64_t ds_fsid_guid;
      143 +        boolean_t ds_is_snapshot;
 140  144  
 141  145          /* only used in syncing context, only valid for non-snapshots: */
 142  146          struct dsl_dataset *ds_prev;
 143  147          uint64_t ds_bookmarks;  /* DMU_OTN_ZAP_METADATA */
 144  148          boolean_t ds_large_blocks;
 145  149          boolean_t ds_need_large_blocks;
 146  150  
 147  151          /* has internal locking: */
 148  152          dsl_deadlist_t ds_deadlist;
 149  153          bplist_t ds_pending_deadlist;
↓ open down ↓ 40 lines elided ↑ open up ↑
 190  194  {
 191  195          return (ds->ds_dbuf->db_data);
 192  196  }
 193  197  
 194  198  /*
 195  199   * The max length of a temporary tag prefix is the number of hex digits
 196  200   * required to express UINT64_MAX plus one for the hyphen.
 197  201   */
 198  202  #define MAX_TAG_PREFIX_LEN      17
 199  203  
 200      -inline boolean_t
 201      -dsl_dataset_is_snapshot(dsl_dataset_t *ds)
 202      -{
 203      -        return (dsl_dataset_phys(ds)->ds_num_children != 0);
 204      -}
 205      -
 206  204  #define DS_UNIQUE_IS_ACCURATE(ds)       \
 207  205          ((dsl_dataset_phys(ds)->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)
 208  206  
 209  207  int dsl_dataset_hold(struct dsl_pool *dp, const char *name, void *tag,
 210  208      dsl_dataset_t **dsp);
 211  209  int dsl_dataset_hold_obj(struct dsl_pool *dp, uint64_t dsobj, void *tag,
 212  210      dsl_dataset_t **);
 213  211  void dsl_dataset_rele(dsl_dataset_t *ds, void *tag);
 214  212  int dsl_dataset_own(struct dsl_pool *dp, const char *name,
 215  213      void *tag, dsl_dataset_t **dsp);
↓ open down ↓ 107 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX