The following was separated from a patchset which performs a fully-smr protected path lookup which only dirties the terminal vnode.
The patch below will be split into two, handling namecache separately. It introduces vnode and namecache entry protection with smr. Forward lookup is then converted to stop taking bucket locks in the common case. This already shows a significant speed up during concurrent stat calls on smaller scales.
The crux of the change is vhold_smr. An argument could be made that a flag should be set while dooming the vnode, but postponing this makes the code simpler, is harmless and opens up possibility of safely doing fetchadd + backpedaling from it in vhold_smr.
It's unclear to me what should be done here with smr accessors. It may be workable to make the hash use it, but it looks like some form of _raw accessors (if any) would be prudent here. Right now the code just asserts. I think the way to go for now is to hide all this behind dedicated macros which happen to be mere atomic load/store etc.