diff options
author | Tom Caputi <[email protected]> | 2018-06-18 17:10:54 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-06-18 14:10:54 -0700 |
commit | cd32e5db8bb4411533dc21cfc12a5af5f3b56701 (patch) | |
tree | 4e0d5b1cda63b2c5603c3995c066aaf2ffcea200 /module/zfs/dbuf.c | |
parent | 517d2471921fc44622dc737b09b655829b8c9c6f (diff) |
Add ASSERT to debug encryption key mapping issues
This patch simply adds an ASSERT that confirms that the last
decrypting reference on a dataset waits until the dataset is
no longer dirty. This should help to debug issues where the
ZIO layer cannot find encryption keys after a dataset has been
disowned.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tom Caputi <[email protected]>
Closes #7637
Diffstat (limited to 'module/zfs/dbuf.c')
-rw-r--r-- | module/zfs/dbuf.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 2411c8d4f..e3738db52 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -3306,6 +3306,20 @@ dbuf_refcount(dmu_buf_impl_t *db) return (refcount_count(&db->db_holds)); } +uint64_t +dmu_buf_user_refcount(dmu_buf_t *db_fake) +{ + uint64_t holds; + dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; + + mutex_enter(&db->db_mtx); + ASSERT3U(refcount_count(&db->db_holds), >=, db->db_dirtycnt); + holds = refcount_count(&db->db_holds) - db->db_dirtycnt; + mutex_exit(&db->db_mtx); + + return (holds); +} + void * dmu_buf_replace_user(dmu_buf_t *db_fake, dmu_buf_user_t *old_user, dmu_buf_user_t *new_user) |