cvs commit: src/sys/fs/udf udf_vfsops.c

Craig Rodrigues rodrigc at crodrigues.org
Thu May 25 20:38:50 PDT 2006


On Thu, May 25, 2006 at 08:57:31PM -0600, Scott Long wrote:
> So is it no longer possible for a filesystem to veto or otherwise 
> massage an export request?

It is still possible.  This is because vfs_export() is
only called in vfs_mount.c, only *after* the VFS_MOUNT()
call for an individual filesystem is called.

An individual filesystem can check the mount options being passed into
its VFS_MOUNT() call, and do a vfs_getopt() and look for the
"export" option, which contains a "struct export_args", which is
eventually passed to vfs_export().

The specific filesystem can do:
(1)  If the mount options passed into the specific filesystem's
     VFS_MOUNT() call contains "export", the filesystem
     can return an error from VFS_MOUNT() if it doesn't want to deal
     with export requests at all.
     The code in vfs_mount.c checks for the return status of VFS_MOUNT,
     and if there is an error, it will *not* call vfs_export().

(2)  If the mount options contains "export", the filesystem
     can do a vfs_getopt(), manipulate the contents of the struct export_args,
     then return 0 (for success).  The code in VFS_MOUNT will
     then call vfs_export(), passing in the same struct export_args
     that the individual filesystem


One example of a filesystem vetoing an "export" request
is in fs/msdosfs/msdosfs_vfsops.c :

                if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0) {   
                        /* Process export requests. */
                        if ((pmp->pm_flags & MSDOSFS_LARGEFS) != 0)
                                return (EOPNOTSUPP);
                        else
                                return (0);
                }


Most of the filesystem code I saw looked like they had
just cut-n-pasted their calls to vfs_export(), so it was
fairly easy to consolidate everything in one place, vfs_mount.c

With my recent changes to mountd, to convert to nmount() and remove hardcoded
dependencies on ufs, cd9660, ntfs, and msdosfs,
it should be easier to export different filesystems from FreeBSD.

For example, it should now be possible to NFS export an ext2fs
from FreeBSD.

-- 
Craig Rodrigues        
rodrigc at crodrigues.org


More information about the cvs-all mailing list