[Bug 260894] Nonexportable file systems are usable over NFSv4

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 08 Jan 2022 17:40:47 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260894

--- Comment #9 from Alan Somers <asomers@FreeBSD.org> ---
So it turns out that I can't use VFS_MOUNT the way I thought.  The MNT_EXPORTED
flag does not get set during that call if because the user wants to export the
file system.  Rather, it is set if the file system is _already_ exported.  The
sequence goes like this:

1) mountd calls nmount with MNT_EXPORTED to export the file system
2) vfs_domount_update calls VFS_MOUNT with the MNT_EXPORTED bit masked out
3) vfs_domount_update calls vfs_export, which actually sets MNT_EXPORTED in the
struct mount.
4) At some later date, if the user removes the file system from /etc/exports,
mountd will call nmount with MNT_EXPORTED unset.
5) vfs_domount_update calls VFS_MOUNT, which sees MNT_EXPORTED set, and returns
an error
6) As a result, the file system does not get unexported

I guess for now I can't do anything smart in VFS_MOUNT.  Instead, I'll just
have to return errors from VOP_VPTOFH.  As an enhancement, it would be nice if
the file system could set some flag that would cause vfs_export to fail.  That
would produce a more useful error message than just returning errors from
VOP_VPTOFH .

-- 
You are receiving this mail because:
You are the assignee for the bug.