Print this page
patch first-pass


 218                 if (dsl_dir_is_clone(dd)) {
 219                         dmu_buf_t *origin_bonus;
 220                         dsl_dataset_phys_t *origin_phys;
 221 
 222                         /*
 223                          * We can't open the origin dataset, because
 224                          * that would require opening this dsl_dir.
 225                          * Just look at its phys directly instead.
 226                          */
 227                         err = dmu_bonus_hold(dp->dp_meta_objset,
 228                             dsl_dir_phys(dd)->dd_origin_obj, FTAG,
 229                             &origin_bonus);
 230                         if (err != 0)
 231                                 goto errout;
 232                         origin_phys = origin_bonus->db_data;
 233                         dd->dd_origin_txg =
 234                             origin_phys->ds_creation_txg;
 235                         dmu_buf_rele(origin_bonus, FTAG);
 236                 }
 237 
 238                 dmu_buf_init_user(&dd->dd_dbu, dsl_dir_evict, &dd->dd_dbuf);

 239                 winner = dmu_buf_set_user_ie(dbuf, &dd->dd_dbu);
 240                 if (winner != NULL) {
 241                         if (dd->dd_parent)
 242                                 dsl_dir_rele(dd->dd_parent, dd);
 243                         dsl_prop_fini(dd);
 244                         mutex_destroy(&dd->dd_lock);
 245                         kmem_free(dd, sizeof (dsl_dir_t));
 246                         dd = winner;
 247                 } else {
 248                         spa_open_ref(dp->dp_spa, dd);
 249                 }
 250         }
 251 
 252         /*
 253          * The dsl_dir_t has both open-to-close and instantiate-to-evict
 254          * holds on the spa.  We need the open-to-close holds because
 255          * otherwise the spa_refcnt wouldn't change when we open a
 256          * dir which the spa also has open, so we could incorrectly
 257          * think it was OK to unload/export/destroy the pool.  We need
 258          * the instantiate-to-evict hold because the dsl_dir_t has a




 218                 if (dsl_dir_is_clone(dd)) {
 219                         dmu_buf_t *origin_bonus;
 220                         dsl_dataset_phys_t *origin_phys;
 221 
 222                         /*
 223                          * We can't open the origin dataset, because
 224                          * that would require opening this dsl_dir.
 225                          * Just look at its phys directly instead.
 226                          */
 227                         err = dmu_bonus_hold(dp->dp_meta_objset,
 228                             dsl_dir_phys(dd)->dd_origin_obj, FTAG,
 229                             &origin_bonus);
 230                         if (err != 0)
 231                                 goto errout;
 232                         origin_phys = origin_bonus->db_data;
 233                         dd->dd_origin_txg =
 234                             origin_phys->ds_creation_txg;
 235                         dmu_buf_rele(origin_bonus, FTAG);
 236                 }
 237 
 238                 dmu_buf_init_user(&dd->dd_dbu, NULL, dsl_dir_evict,
 239                     &dd->dd_dbuf);
 240                 winner = dmu_buf_set_user_ie(dbuf, &dd->dd_dbu);
 241                 if (winner != NULL) {
 242                         if (dd->dd_parent)
 243                                 dsl_dir_rele(dd->dd_parent, dd);
 244                         dsl_prop_fini(dd);
 245                         mutex_destroy(&dd->dd_lock);
 246                         kmem_free(dd, sizeof (dsl_dir_t));
 247                         dd = winner;
 248                 } else {
 249                         spa_open_ref(dp->dp_spa, dd);
 250                 }
 251         }
 252 
 253         /*
 254          * The dsl_dir_t has both open-to-close and instantiate-to-evict
 255          * holds on the spa.  We need the open-to-close holds because
 256          * otherwise the spa_refcnt wouldn't change when we open a
 257          * dir which the spa also has open, so we could incorrectly
 258          * think it was OK to unload/export/destroy the pool.  We need
 259          * the instantiate-to-evict hold because the dsl_dir_t has a