svn commit: r230252 - head/sys/fs/tmpfs
Kevin Lo
kevlo at FreeBSD.org
Sun Jan 22 16:18:37 UTC 2012
Jaakko Heinonen wrote:
> Hi,
Hi Jaakko,
> On 2012-01-22, Mikolaj Golub wrote:
> > JH> # mount -u -o ro /mnt
> > JH> mount: tmpfs : Operation not supported
> > JH> # mount -u -o ro,export /mnt
> > JH> #
> >
> > There is no error but ro is still ignored, so this is only the issue with
> > reporting. Note, the code for nullfs (as an example) looks the same.
>
> This is not true. "ro" is not ignored:
>
> # mount -t tmpfs
> tmpfs on /mnt (tmpfs, local)
> # mount -u -o ro /mnt
> mount: tmpfs: Operation not supported
> # mount -t tmpfs
> tmpfs on /mnt (tmpfs, local)
> # mount -u -o ro,export /mnt
> # mount -t tmpfs
> tmpfs on /mnt (tmpfs, local, read-only)
>
> > It could be fixed with vfs_filteropt(9), not sure if this is worth doing here
> > though.
>
> The problem with vfs_filteropt(9) is that it will allow some additional
> options (global_opts list in vfs_mount.c). However those options might
> already work sufficiently with update mount. Here is a mostly untested
> patch:
>
> %%%
> Index: sys/fs/tmpfs/tmpfs_vfsops.c
> ===================================================================
> --- sys/fs/tmpfs/tmpfs_vfsops.c (revision 230328)
> +++ sys/fs/tmpfs/tmpfs_vfsops.c (working copy)
> @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = {
> NULL
> };
>
> +static const char *tmpfs_updateopts[] = {
> + "from", "export", NULL
> +};
> +
> /* --------------------------------------------------------------------- */
>
> static int
> @@ -150,12 +154,10 @@ tmpfs_mount(struct mount *mp)
> return (EINVAL);
>
> if (mp->mnt_flag & MNT_UPDATE) {
> - /*
> - * Only support update mounts for NFS export.
> - */
> - if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0))
> - return (0);
> - return (EOPNOTSUPP);
> + /* Only support update mounts for certain options. */
> + if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
> + return (EOPNOTSUPP);
> + return (0);
> }
>
> vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
> %%%
Sorry for the late reply since I'm still off work for holidays
(Chinese New Year). I'll report back in a few weeks. If you
have a patch, please commit it, thanks a lot!
Kevin
More information about the svn-src-all
mailing list