/*
* Head deletion is processed in one txg on old pools;
* remove the objects from open context so that the txg sync
- * is not too long.
+ * is not too long. This optimization can only work for
+ * encrypted datasets if the wrapping key is loaded.
*/
- error = dmu_objset_own(name, DMU_OST_ANY, B_FALSE, B_FALSE,
+ error = dmu_objset_own(name, DMU_OST_ANY, B_FALSE, B_TRUE,
FTAG, &os);
if (error == 0) {
uint64_t prev_snap_txg =
(void) dmu_free_long_object(os, obj);
/* sync out all frees */
txg_wait_synced(dmu_objset_pool(os), 0);
- dmu_objset_disown(os, B_FALSE, FTAG);
+ dmu_objset_disown(os, B_TRUE, FTAG);
}
}