There's no apparent reason for unionfs vnodesUse atomics to track the writecount granted to manage v_writecountthe underlying FS,
themselves. Coordinatand avoid holding the writecount withvnode interlock while calling the underlying filesystemFS'
is also error-prone particularly where text refs are concerned.
Instead, just pass VOP_ADD_WRITECOUNT to the appropriate underlyVOP_ADD_WRITECOUNT(). This also fixes a WITNESS warning about nesting
the same lock type. Also add comments explaining why we need to track
the writecount on the unionfs vnode.e in the first place.
unionfs: implement VOP_SET_TEXT/VOP_UNSET_TEXT
The implementation simply passes the text ref to the appropriate
underlying vnode. Without this, the default [un]set_text
implementation will only manage the text ref on the unionfs vnode,
causing it to be out of sync with the underlying filesystems and
potentially allowing corruption of executable file contents.
On INVARIANTS kernels, it also readily produces a panic on process
termination because the VM object representing the executable mapping
is backed by the underlying vnode, not the unionfs vnode.