Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jan 2012 15:42:18 +0200
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        Mikolaj Golub <trociny@freebsd.org>
Cc:        svn-src-head@freebsd.org, Kevin Lo <kevlo@FreeBSD.org>, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r230252 - head/sys/fs/tmpfs
Message-ID:  <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi>
In-Reply-To: <86obtvvr4v.fsf@kopusha.home.net>
References:  <201201170125.q0H1PrlJ061058@svn.freebsd.org> <20120117171031.GA2316@a91-153-116-96.elisa-laajakaista.fi> <86obtvvr4v.fsf@kopusha.home.net>

next in thread | previous in thread | raw e-mail | index | archive | help

Hi,

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);
%%%

-- 
Jaakko



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120122134218.GA2247>