Re: nullfs traversing mount points (with working code)

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Wed, 08 Dec 2021 20:22:44 UTC
On Mon, Dec 06, 2021 at 10:31:28PM -0800, Luoqi Chen wrote:
> Hi,
> 
> Recently I had the need to access nfs automounts (for example /net) from
> within jails, I searched everywhere but couldn't find any suitable
> solution. It seems we still don't support mount point traversal in nullfs,
> even though many people have asked for it. I had no choice so I spent a bit
> of time adding the support myself, which worked satisfactorily for my own
> purpose. I wonder if anyone's interested in taking the code, polishing it
> and eventually checking it in. The patch against 13.0-RELENG is at
> https://people.freebsd.org/~luoqi/nullxmnt.diff

Let's put a note about wanting this feature aside.
It is not just polishing, the code is mostly wrong.

From a very quick look, it breaks a lot of VFS expectations from a filesystem.

For instance, nullfs inherits some behavior flags from the lower fs, which
is no longer true with your patch, like mnt_kern_flags initialization in
nullfs_mount().

A look at the update to the null_lookup() indicates that you are busying
some filesystem while owning some other vnode lock.

I suspect that after this update, null_lookup() might call VOP_LOOKUP()
for dotdot on rootvp for some mountpoint.

At this point I stopped looking.