Here is an alternative to D38144 using a reference to the
credentials that did the exports. Although reviewers
suggested this, I resisted because I was thinking I had
to get rid of exports when a jail is removed and that
was too difficult.
I realized that all I needed to do was release the credentials
and set mnt_exjail = NULL. Then, deletion/replacement of
the exports can be done "lazily" when vfs_export() is called.
I defined a function called vfs_exjail_delete(), which I currently
call from the nfsd'd OSD PR_MOETHOD_REMOVE which
releases credentials and set mnt_exjail NULL for all cases
matching the prison argument.
Maybe this function should be called from within kern_jail.c
via prison_cleanup()?
I think this is a better alternative to D38144 and if this
looks good, I will revert the commit of D38144 and commit
this instead. Thanks to all that hinted this was the way to go.
As they say "if at first you don't succeed, try try again...".