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>


 515         td.td_resume = resume;
 516         td.td_func = func;
 517         td.td_arg = arg;
 518         td.td_pfd = &pd;
 519         td.td_flags = flags;
 520         td.td_paused = B_FALSE;
 521 
 522         if (spa_feature_is_active(spa, SPA_FEATURE_HOLE_BIRTH)) {
 523                 VERIFY(spa_feature_enabled_txg(spa,
 524                     SPA_FEATURE_HOLE_BIRTH, &td.td_hole_birth_enabled_txg));
 525         } else {
 526                 td.td_hole_birth_enabled_txg = 0;
 527         }
 528 
 529         pd.pd_blks_max = zfs_pd_blks_max;
 530         pd.pd_flags = flags;
 531         mutex_init(&pd.pd_mtx, NULL, MUTEX_DEFAULT, NULL);
 532         cv_init(&pd.pd_cv, NULL, CV_DEFAULT, NULL);
 533 
 534         /* See comment on ZIL traversal in dsl_scan_visitds. */
 535         if (ds != NULL && !dsl_dataset_is_snapshot(ds) && !BP_IS_HOLE(rootbp)) {
 536                 arc_flags_t flags = ARC_FLAG_WAIT;
 537                 objset_phys_t *osp;
 538                 arc_buf_t *buf;
 539 
 540                 err = arc_read(NULL, td.td_spa, rootbp,
 541                     arc_getbuf_func, &buf,
 542                     ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, NULL);
 543                 if (err != 0)
 544                         return (err);
 545 
 546                 osp = buf->b_data;
 547                 traverse_zil(&td, &osp->os_zil_header);
 548                 (void) arc_buf_remove_ref(buf, &buf);
 549         }
 550 
 551         if (!(flags & TRAVERSE_PREFETCH_DATA) ||
 552             0 == taskq_dispatch(system_taskq, traverse_prefetch_thread,
 553             &td, TQ_NOQUEUE))
 554                 pd.pd_exited = B_TRUE;
 555 




 515         td.td_resume = resume;
 516         td.td_func = func;
 517         td.td_arg = arg;
 518         td.td_pfd = &pd;
 519         td.td_flags = flags;
 520         td.td_paused = B_FALSE;
 521 
 522         if (spa_feature_is_active(spa, SPA_FEATURE_HOLE_BIRTH)) {
 523                 VERIFY(spa_feature_enabled_txg(spa,
 524                     SPA_FEATURE_HOLE_BIRTH, &td.td_hole_birth_enabled_txg));
 525         } else {
 526                 td.td_hole_birth_enabled_txg = 0;
 527         }
 528 
 529         pd.pd_blks_max = zfs_pd_blks_max;
 530         pd.pd_flags = flags;
 531         mutex_init(&pd.pd_mtx, NULL, MUTEX_DEFAULT, NULL);
 532         cv_init(&pd.pd_cv, NULL, CV_DEFAULT, NULL);
 533 
 534         /* See comment on ZIL traversal in dsl_scan_visitds. */
 535         if (ds != NULL && !ds->ds_is_snapshot && !BP_IS_HOLE(rootbp)) {
 536                 arc_flags_t flags = ARC_FLAG_WAIT;
 537                 objset_phys_t *osp;
 538                 arc_buf_t *buf;
 539 
 540                 err = arc_read(NULL, td.td_spa, rootbp,
 541                     arc_getbuf_func, &buf,
 542                     ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, NULL);
 543                 if (err != 0)
 544                         return (err);
 545 
 546                 osp = buf->b_data;
 547                 traverse_zil(&td, &osp->os_zil_header);
 548                 (void) arc_buf_remove_ref(buf, &buf);
 549         }
 550 
 551         if (!(flags & TRAVERSE_PREFETCH_DATA) ||
 552             0 == taskq_dispatch(system_taskq, traverse_prefetch_thread,
 553             &td, TQ_NOQUEUE))
 554                 pd.pd_exited = B_TRUE;
 555