]> granicus.if.org Git - zfs/commit
Fix dnode_hold() freeing dnode behavior
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 5 Dec 2018 17:29:33 +0000 (09:29 -0800)
committerGitHub <noreply@github.com>
Wed, 5 Dec 2018 17:29:33 +0000 (09:29 -0800)
commit78e21394679ed7435f9b0d10a56ce4f679c680fe
tree224dd7c736ae3ed1914c9ceeefcb63ef09395ae4
parentc5eea0ab9c0ce31b172eac948c32a6cea5d0965f
Fix dnode_hold() freeing dnode behavior

Commit 4c5b89f59 refactored dnode_hold() and in the process
accidentally introduced a slight change in behavior which was
not intended.  The required behavior is that once the ZPL,
or other consumer, declares its intent to free a dnode then
dnode_hold() should immediately start failing.  This updated
code wouldn't return the failure until after it was freed.

When DNODE_MUST_BE_ALLOCATED is set it must return ENOENT, and
when DNODE_MUST_BE_FREE is set it must return EEXIST;

This issue was uncovered by ztest_remap() which attempted
to remap a freeing object which should have been skipped as
described by the comment in dmu_objset_remap_indirects_impl().

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #8172
module/zfs/dnode.c