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>


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  24  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.

  25  */
  26 
  27 #ifndef _SYS_DBUF_H
  28 #define _SYS_DBUF_H
  29 
  30 #include <sys/dmu.h>
  31 #include <sys/spa.h>
  32 #include <sys/txg.h>
  33 #include <sys/zio.h>
  34 #include <sys/arc.h>
  35 #include <sys/zfs_context.h>
  36 #include <sys/refcount.h>
  37 #include <sys/zrlock.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 #define IN_DMU_SYNC 2
  44 


 209          */
 210         refcount_t db_holds;
 211 
 212         /* buffer holding our data */
 213         arc_buf_t *db_buf;
 214 
 215         kcondvar_t db_changed;
 216         dbuf_dirty_record_t *db_data_pending;
 217 
 218         /* pointer to most recent dirty record for this buffer */
 219         dbuf_dirty_record_t *db_last_dirty;
 220 
 221         /*
 222          * Our link on the owner dnodes's dn_dbufs list.
 223          * Protected by its dn_dbufs_mtx.
 224          */
 225         avl_node_t db_link;
 226 
 227         /* Data which is unique to data (leaf) blocks: */
 228 
 229         /* stuff we store for the user (see dmu_buf_set_user) */
 230         void *db_user_ptr;
 231         dmu_buf_evict_func_t *db_evict_func;
 232 
 233         uint8_t db_immediate_evict;
 234         uint8_t db_freed_in_flight;
 235 
 236         uint8_t db_dirtycnt;
 237 } dmu_buf_impl_t;
 238 
 239 /* Note: the dbuf hash table is exposed only for the mdb module */
 240 #define DBUF_MUTEXES 256
 241 #define DBUF_HASH_MUTEX(h, idx) (&(h)->hash_mutexes[(idx) & (DBUF_MUTEXES-1)])
 242 typedef struct dbuf_hash_table {
 243         uint64_t hash_table_mask;
 244         dmu_buf_impl_t **hash_table;
 245         kmutex_t hash_mutexes[DBUF_MUTEXES];
 246 } dbuf_hash_table_t;
 247 
 248 
 249 uint64_t dbuf_whichblock(struct dnode *di, uint64_t offset);
 250 
 251 dmu_buf_impl_t *dbuf_create_tlib(struct dnode *dn, char *data);




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  24  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  25  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  26  */
  27 
  28 #ifndef _SYS_DBUF_H
  29 #define _SYS_DBUF_H
  30 
  31 #include <sys/dmu.h>
  32 #include <sys/spa.h>
  33 #include <sys/txg.h>
  34 #include <sys/zio.h>
  35 #include <sys/arc.h>
  36 #include <sys/zfs_context.h>
  37 #include <sys/refcount.h>
  38 #include <sys/zrlock.h>
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 #define IN_DMU_SYNC 2
  45 


 210          */
 211         refcount_t db_holds;
 212 
 213         /* buffer holding our data */
 214         arc_buf_t *db_buf;
 215 
 216         kcondvar_t db_changed;
 217         dbuf_dirty_record_t *db_data_pending;
 218 
 219         /* pointer to most recent dirty record for this buffer */
 220         dbuf_dirty_record_t *db_last_dirty;
 221 
 222         /*
 223          * Our link on the owner dnodes's dn_dbufs list.
 224          * Protected by its dn_dbufs_mtx.
 225          */
 226         avl_node_t db_link;
 227 
 228         /* Data which is unique to data (leaf) blocks: */
 229 
 230         /* User callback information. */
 231         dmu_buf_user_t *db_user;

 232 
 233         uint8_t db_immediate_evict;
 234         uint8_t db_freed_in_flight;
 235 
 236         uint8_t db_dirtycnt;
 237 } dmu_buf_impl_t;
 238 
 239 /* Note: the dbuf hash table is exposed only for the mdb module */
 240 #define DBUF_MUTEXES 256
 241 #define DBUF_HASH_MUTEX(h, idx) (&(h)->hash_mutexes[(idx) & (DBUF_MUTEXES-1)])
 242 typedef struct dbuf_hash_table {
 243         uint64_t hash_table_mask;
 244         dmu_buf_impl_t **hash_table;
 245         kmutex_t hash_mutexes[DBUF_MUTEXES];
 246 } dbuf_hash_table_t;
 247 
 248 
 249 uint64_t dbuf_whichblock(struct dnode *di, uint64_t offset);
 250 
 251 dmu_buf_impl_t *dbuf_create_tlib(struct dnode *dn, char *data);