Skip to content

Commit

Permalink
now fails looking up the key mapping
Browse files Browse the repository at this point in the history
Signed-off-by: George Amanakis <[email protected]>
  • Loading branch information
gamanakis committed Feb 19, 2021
1 parent f4512d2 commit 6b51856
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
6 changes: 5 additions & 1 deletion module/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,11 @@ dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting)
dmu_buf_impl_t *db = dn->dn_dbuf;
dnode_handle_t *dnh = dn->dn_handle;

refs = zfs_refcount_remove(&dn->dn_holds, tag);
if (zfs_refcount_count(&dn->dn_holds) > 0) {
refs = zfs_refcount_remove(&dn->dn_holds, tag);
} else {
refs = 0;
}
if (refs == 0)
cv_broadcast(&dn->dn_nodnholds);
mutex_exit(&dn->dn_mtx);
Expand Down
5 changes: 3 additions & 2 deletions module/zfs/dnode_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,11 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *tx)
ASSERT(dn->dn_type != DMU_OT_NONE);

ASSERT(dn->dn_free_txg > 0);
if (dn->dn_allocated_txg != dn->dn_free_txg)
if (dn->dn_allocated_txg != dn->dn_free_txg && &dn->dn_dbuf->db != NULL)
dmu_buf_will_dirty(&dn->dn_dbuf->db, tx);
bzero(dn->dn_phys, sizeof (dnode_phys_t) * dn->dn_num_slots);
dnode_free_interior_slots(dn);
if (&dn->dn_dbuf->db != NULL)
dnode_free_interior_slots(dn);

mutex_enter(&dn->dn_mtx);
dn->dn_type = DMU_OT_NONE;
Expand Down
9 changes: 7 additions & 2 deletions module/zfs/dsl_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2687,14 +2687,18 @@ spa_do_crypt_objset_mac_abd(boolean_t generate, spa_t *spa, uint64_t dsobj,

/* look up the key from the spa's keystore */
ret = spa_keystore_lookup_key(spa, dsobj, FTAG, &dck);
if (ret != 0)
if (ret != 0) {
zfs_dbgmsg("lookup failed");
goto error;
}

/* calculate both HMACs */
ret = zio_crypt_do_objset_hmacs(&dck->dck_key, buf, datalen,
byteswap, portable_mac, local_mac);
if (ret != 0)
if (ret != 0) {
zfs_dbgmsg("calc failed");
goto error;
}

spa_keystore_dsl_key_rele(spa, dck, FTAG);

Expand All @@ -2709,6 +2713,7 @@ spa_do_crypt_objset_mac_abd(boolean_t generate, spa_t *spa, uint64_t dsobj,
if (bcmp(portable_mac, osp->os_portable_mac, ZIO_OBJSET_MAC_LEN) != 0 ||
bcmp(local_mac, osp->os_local_mac, ZIO_OBJSET_MAC_LEN) != 0) {
abd_return_buf(abd, buf, datalen);
zfs_dbgmsg("cksum failed");
return (SET_ERROR(ECKSUM));
}

Expand Down

0 comments on commit 6b51856

Please sign in to comment.