Print this page
3743 zfs needs a refcount audit
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>
Reviewed by:    Eric Schrock <eric.schrock@delphix.com>
Reviewed by:    George Wilson <george.wilson@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dsl_dataset.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_dataset.c
↓ open down ↓ 348 lines elided ↑ open up ↑
 349  349          dmu_object_info_t doi;
 350  350  
 351  351          ASSERT(dsl_pool_config_held(dp));
 352  352  
 353  353          err = dmu_bonus_hold(mos, dsobj, tag, &dbuf);
 354  354          if (err != 0)
 355  355                  return (err);
 356  356  
 357  357          /* Make sure dsobj has the correct object type. */
 358  358          dmu_object_info_from_db(dbuf, &doi);
 359      -        if (doi.doi_type != DMU_OT_DSL_DATASET)
      359 +        if (doi.doi_type != DMU_OT_DSL_DATASET) {
      360 +                dmu_buf_rele(dbuf, tag);
 360  361                  return (SET_ERROR(EINVAL));
      362 +        }
 361  363  
 362  364          ds = dmu_buf_get_user(dbuf);
 363  365          if (ds == NULL) {
 364  366                  dsl_dataset_t *winner = NULL;
 365  367  
 366  368                  ds = kmem_zalloc(sizeof (dsl_dataset_t), KM_SLEEP);
 367  369                  ds->ds_dbuf = dbuf;
 368  370                  ds->ds_object = dsobj;
 369  371                  ds->ds_phys = dbuf->db_data;
 370  372  
↓ open down ↓ 2556 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX