Move dmu_buf_rele() after dsl_dataset_sync_done()
Otherwise the dataset may be freed after the last dmu_buf_rele() leading to a panic. Reviewed-by: Mark Maybee <mark.maybee@delphix.com> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #14522 Closes #14523
This commit is contained in:
parent
6109d83df8
commit
d816bc5ec7
|
@ -1301,6 +1301,7 @@ dmu_objset_create_sync(void *arg, dmu_tx_t *tx)
|
||||||
ASSERT3P(ds->ds_key_mapping, !=, NULL);
|
ASSERT3P(ds->ds_key_mapping, !=, NULL);
|
||||||
key_mapping_rele(spa, ds->ds_key_mapping, ds);
|
key_mapping_rele(spa, ds->ds_key_mapping, ds);
|
||||||
dsl_dataset_sync_done(ds, tx);
|
dsl_dataset_sync_done(ds, tx);
|
||||||
|
dmu_buf_rele(ds->ds_dbuf, ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_enter(&ds->ds_lock);
|
mutex_enter(&ds->ds_lock);
|
||||||
|
|
|
@ -2119,9 +2119,6 @@ dsl_crypto_recv_raw_objset_sync(dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
||||||
zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
|
zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
|
||||||
dsl_dataset_sync(ds, zio, tx);
|
dsl_dataset_sync(ds, zio, tx);
|
||||||
VERIFY0(zio_wait(zio));
|
VERIFY0(zio_wait(zio));
|
||||||
|
|
||||||
/* dsl_dataset_sync_done will drop this reference. */
|
|
||||||
dmu_buf_add_ref(ds->ds_dbuf, ds);
|
|
||||||
dsl_dataset_sync_done(ds, tx);
|
dsl_dataset_sync_done(ds, tx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1272,9 +1272,6 @@ dsl_dataset_zero_zil(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||||
zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
|
zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
|
||||||
dsl_dataset_sync(ds, zio, tx);
|
dsl_dataset_sync(ds, zio, tx);
|
||||||
VERIFY0(zio_wait(zio));
|
VERIFY0(zio_wait(zio));
|
||||||
|
|
||||||
/* dsl_dataset_sync_done will drop this reference. */
|
|
||||||
dmu_buf_add_ref(ds->ds_dbuf, ds);
|
|
||||||
dsl_dataset_sync_done(ds, tx);
|
dsl_dataset_sync_done(ds, tx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2271,10 +2268,6 @@ dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||||
else
|
else
|
||||||
ASSERT0(os->os_next_write_raw[tx->tx_txg & TXG_MASK]);
|
ASSERT0(os->os_next_write_raw[tx->tx_txg & TXG_MASK]);
|
||||||
|
|
||||||
ASSERT(!dmu_objset_is_dirty(os, dmu_tx_get_txg(tx)));
|
|
||||||
|
|
||||||
dmu_buf_rele(ds->ds_dbuf, ds);
|
|
||||||
|
|
||||||
for (spa_feature_t f = 0; f < SPA_FEATURES; f++) {
|
for (spa_feature_t f = 0; f < SPA_FEATURES; f++) {
|
||||||
if (zfeature_active(f,
|
if (zfeature_active(f,
|
||||||
ds->ds_feature_activation[f])) {
|
ds->ds_feature_activation[f])) {
|
||||||
|
@ -2285,6 +2278,8 @@ dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||||
ds->ds_feature[f] = ds->ds_feature_activation[f];
|
ds->ds_feature[f] = ds->ds_feature_activation[f];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASSERT(!dmu_objset_is_dirty(os, dmu_tx_get_txg(tx)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -788,6 +788,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
|
||||||
}
|
}
|
||||||
|
|
||||||
dsl_dataset_sync_done(ds, tx);
|
dsl_dataset_sync_done(ds, tx);
|
||||||
|
dmu_buf_rele(ds->ds_dbuf, ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((dd = txg_list_remove(&dp->dp_dirty_dirs, txg)) != NULL) {
|
while ((dd = txg_list_remove(&dp->dp_dirty_dirs, txg)) != NULL) {
|
||||||
|
|
Loading…
Reference in New Issue