https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229614
Over the course of many revisions to the vnode/znode locking code, the check in zfs_zget() for 'this vnode is being unlinked' was lost.
The PR above contains a reproduction case I used to investigate and solve this.
This patch brings the code closer inline with what is in IllumOS.
I plan a followup commit to cleanup some excess delta that has grown over time, but this fix should be MFCd to stable/11, so I didn't want to pollute it with other changes.
Open Question: do we need any additional locking to safely read zp->z_unlinked?