Date: Mon, 23 Jan 2012 00:18:33 +0800 From: Kevin Lo <kevlo@FreeBSD.org> To: Jaakko Heinonen <jh@FreeBSD.org> Cc: Mikolaj Golub <trociny@FreeBSD.org>, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230252 - head/sys/fs/tmpfs Message-ID: <1327249113.2057.5.camel@nsl> In-Reply-To: <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi> References: <201201170125.q0H1PrlJ061058@svn.freebsd.org> <20120117171031.GA2316@a91-153-116-96.elisa-laajakaista.fi> <86obtvvr4v.fsf@kopusha.home.net> <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1327249113.2057.5.camel>
