John Poduska e6b28efccc
Prevent race condition in dnode_dest (#10101)
dnode_special_close() waits for the refcount of dn_holds to go to zero
without holding the dn_mtx. dnode_rele_and_unlock() does the final
remove to dn_holds with dn_mtx being held:

	refs = zfs_refcount_remove(&dn->dn_holds, tag);
	mutex_exit(&dn->dn_mtx);

So, there is a race condition after the remove until dn_mtx is
dropped. During that time, dnode_destroy() can get called, which ends
up in dnode_dest() calling mutex_destroy() and a panic since the lock
is still held.

This change adds a condvar to wait for the final dnode_rele_and_unlock()
to release the dn_mtx before calling dnode_destroy().

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: John Poduska <jpoduska@datto.com>
Closes #7814
Closes #10101
2020-03-12 10:25:56 -07:00
..
2019-07-26 10:54:14 -07:00
2019-06-19 09:48:12 -07:00
2019-06-19 09:48:12 -07:00
2020-02-27 17:12:44 -08:00
2019-10-09 10:36:03 -07:00
2019-12-03 09:51:44 -08:00
2020-02-24 15:38:22 -08:00
2019-09-02 17:56:41 -07:00
2017-10-11 16:54:48 -04:00
2019-10-01 13:17:32 -07:00
2015-01-16 14:41:26 -08:00
2019-06-19 09:48:12 -07:00
2019-10-11 10:13:21 -07:00
2010-08-31 13:41:58 -07:00
2019-09-02 17:56:41 -07:00
2020-03-04 15:07:11 -08:00
2019-10-09 10:36:03 -07:00
2020-02-27 09:31:02 -08:00
2019-06-20 18:29:02 -07:00
2020-01-23 11:01:24 -08:00
2019-06-20 18:29:02 -07:00
2020-03-04 15:07:11 -08:00
2019-09-05 14:49:49 -07:00
2019-09-02 17:56:41 -07:00
2019-09-02 17:56:41 -07:00
2019-10-02 09:15:12 -07:00
2019-11-11 09:27:59 -08:00
2019-12-05 13:10:29 -08:00
2018-02-09 10:08:05 -08:00
2019-07-26 10:54:14 -07:00