mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
Encryption patch follow-up
* PBKDF2 implementation changed to OpenSSL implementation. * HKDF implementation moved to its own file and tests added to ensure correctness. * Removed libzfs's now unnecessary dependency on libzpool and libicp. * Ztest can now create and test encrypted datasets. This is currently disabled until issue #6526 is resolved, but otherwise functions as advertised. * Several small bug fixes discovered after enabling ztest to run on encrypted datasets. * Fixed coverity defects added by the encryption patch. * Updated man pages for encrypted send / receive behavior. * Fixed a bug where encrypted datasets could receive DRR_WRITE_EMBEDDED records. * Minor code cleanups / consolidation. Signed-off-by: Tom Caputi <tcaputi@datto.com>
This commit is contained in:
+18
-7
@@ -706,7 +706,9 @@ dmu_objset_own(const char *name, dmu_objset_type_t type,
|
||||
|
||||
dsl_pool_rele(dp, FTAG);
|
||||
|
||||
if (dmu_objset_userobjspace_upgradable(*osp))
|
||||
/* user accounting requires the dataset to be decrypted */
|
||||
if (dmu_objset_userobjspace_upgradable(*osp) &&
|
||||
(ds->ds_dir->dd_crypto_obj == 0 || decrypt))
|
||||
dmu_objset_userobjspace_upgrade(*osp);
|
||||
|
||||
return (0);
|
||||
@@ -932,7 +934,7 @@ dmu_objset_create_impl_dnstats(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
|
||||
|
||||
if (blksz == 0)
|
||||
blksz = DNODE_BLOCK_SIZE;
|
||||
if (blksz == 0)
|
||||
if (ibs == 0)
|
||||
ibs = DN_MAX_INDBLKSHIFT;
|
||||
|
||||
if (ds != NULL)
|
||||
@@ -1096,7 +1098,7 @@ dmu_objset_create_sync(void *arg, dmu_tx_t *tx)
|
||||
}
|
||||
|
||||
/*
|
||||
* The doca_userfunc() will write out some data that needs to be
|
||||
* The doca_userfunc() may write out some data that needs to be
|
||||
* encrypted if the dataset is encrypted (specifically the root
|
||||
* directory). This data must be written out before the encryption
|
||||
* key mapping is removed by dsl_dataset_rele_flags(). Force the
|
||||
@@ -1107,10 +1109,14 @@ dmu_objset_create_sync(void *arg, dmu_tx_t *tx)
|
||||
dsl_dataset_t *tmpds = NULL;
|
||||
boolean_t need_sync_done = B_FALSE;
|
||||
|
||||
mutex_enter(&ds->ds_lock);
|
||||
ds->ds_owner = FTAG;
|
||||
mutex_exit(&ds->ds_lock);
|
||||
|
||||
rzio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
|
||||
tmpds = txg_list_remove(&dp->dp_dirty_datasets, tx->tx_txg);
|
||||
tmpds = txg_list_remove_this(&dp->dp_dirty_datasets, ds,
|
||||
tx->tx_txg);
|
||||
if (tmpds != NULL) {
|
||||
ASSERT3P(ds, ==, tmpds);
|
||||
dsl_dataset_sync(ds, rzio, tx);
|
||||
need_sync_done = B_TRUE;
|
||||
}
|
||||
@@ -1120,9 +1126,9 @@ dmu_objset_create_sync(void *arg, dmu_tx_t *tx)
|
||||
taskq_wait(dp->dp_sync_taskq);
|
||||
|
||||
rzio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
|
||||
tmpds = txg_list_remove(&dp->dp_dirty_datasets, tx->tx_txg);
|
||||
tmpds = txg_list_remove_this(&dp->dp_dirty_datasets, ds,
|
||||
tx->tx_txg);
|
||||
if (tmpds != NULL) {
|
||||
ASSERT3P(ds, ==, tmpds);
|
||||
dmu_buf_rele(ds->ds_dbuf, ds);
|
||||
dsl_dataset_sync(ds, rzio, tx);
|
||||
}
|
||||
@@ -1130,6 +1136,10 @@ dmu_objset_create_sync(void *arg, dmu_tx_t *tx)
|
||||
|
||||
if (need_sync_done)
|
||||
dsl_dataset_sync_done(ds, tx);
|
||||
|
||||
mutex_enter(&ds->ds_lock);
|
||||
ds->ds_owner = NULL;
|
||||
mutex_exit(&ds->ds_lock);
|
||||
}
|
||||
|
||||
spa_history_log_internal_ds(ds, "create", tx, "");
|
||||
@@ -1336,6 +1346,7 @@ dmu_objset_upgrade_stop(objset_t *os)
|
||||
mutex_exit(&os->os_upgrade_lock);
|
||||
|
||||
taskq_cancel_id(os->os_spa->spa_upgrade_taskq, id);
|
||||
txg_wait_synced(os->os_spa->spa_dsl_pool, 0);
|
||||
} else {
|
||||
mutex_exit(&os->os_upgrade_lock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user