aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorTom Caputi <tcaputi@datto.com>2019-01-10 17:36:23 -0500
committerBrian Behlendorf <behlendorf1@llnl.gov>2019-01-10 14:36:23 -0800
commit58769a4ebd462461131f19cccf25c3d19a4dbfb5 (patch)
tree427986931feacf1af02fb1f7760cae5d26ecacde /module/zfs
parent8bd2a2866ccc3f606566ce5503b32053948513ab (diff)
Don't allow dnode allocation if dn_holds != 0
This patch simply fixes a small bug where dnode_hold_impl() could attempt to allocate a dnode that was in the process of being freed, but which still had active references. This patch simply adds the required check. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tom Caputi <tcaputi@datto.com> Closes #8249
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dnode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
index 0e9a4dabe..b7a7f90cf 100644
--- a/module/zfs/dnode.c
+++ b/module/zfs/dnode.c
@@ -1106,6 +1106,7 @@ dnode_check_slots_free(dnode_children_t *children, int idx, int slots)
} else if (DN_SLOT_IS_PTR(dn)) {
mutex_enter(&dn->dn_mtx);
boolean_t can_free = (dn->dn_type == DMU_OT_NONE &&
+ zfs_refcount_is_zero(&dn->dn_holds) &&
!DNODE_IS_DIRTY(dn));
mutex_exit(&dn->dn_mtx);