Date: Thu, 25 May 2006 23:38:40 -0400 From: Craig Rodrigues <rodrigc@crodrigues.org> To: Scott Long <scottl@samsco.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/fs/udf udf_vfsops.c Message-ID: <20060526033840.GA9864@crodrigues.org> In-Reply-To: <44766E9B.6030000@samsco.org> References: <200605260121.k4Q1LqLd098354@repoman.freebsd.org> <44766E9B.6030000@samsco.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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@crodrigues.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060526033840.GA9864>