diff options
Diffstat (limited to 'module/zfs/dsl_dataset.c')
-rw-r--r-- | module/zfs/dsl_dataset.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index 7a4721e17..9db6d1e0b 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -791,6 +791,15 @@ dsl_dataset_rele_flags(dsl_dataset_t *ds, ds_hold_flags_t flags, void *tag) (flags & DS_HOLD_FLAG_DECRYPT)) { (void) spa_keystore_remove_mapping(ds->ds_dir->dd_pool->dp_spa, ds->ds_object, ds); + + /* + * Encrypted datasets require that users only release their + * decrypting reference after the dirty data has actually + * been written out. This ensures that the mapping exists + * when it is needed to write out dirty data. + */ + ASSERT(dmu_buf_user_refcount(ds->ds_dbuf) != 0 || + !dsl_dataset_is_dirty(ds)); } dmu_buf_rele(ds->ds_dbuf, tag); |