summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs/tmpfs_vfsops.c
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2012-04-16 18:07:42 +0000
committerjh <jh@FreeBSD.org>2012-04-16 18:07:42 +0000
commite8d1b1d0ceb24d95d85f7c891e331770603faf6e (patch)
tree71c8ec4a368a0272fca8d63986855490f395e094 /sys/fs/tmpfs/tmpfs_vfsops.c
parent0391812a99fdda0fe460006e04e1709bb19ff3a9 (diff)
downloadFreeBSD-src-e8d1b1d0ceb24d95d85f7c891e331770603faf6e.zip
FreeBSD-src-e8d1b1d0ceb24d95d85f7c891e331770603faf6e.tar.gz
tmpfs: Allow update mounts only for certain options.
Since r230208 update mounts were allowed if the list of mount options contained the "export" option. This is not correct as tmpfs doesn't really support updating all options. Reviewed by: kevlo, trociny
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_vfsops.c')
-rw-r--r--sys/fs/tmpfs/tmpfs_vfsops.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c
index 96d7321..a08dafa 100644
--- a/sys/fs/tmpfs/tmpfs_vfsops.c
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c
@@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = {
NULL
};
+static const char *tmpfs_updateopts[] = {
+ "from", "export", NULL
+};
+
/* --------------------------------------------------------------------- */
static int
@@ -150,12 +154,13 @@ 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);
+ if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) !=
+ ((struct tmpfs_mount *)mp->mnt_data)->tm_ronly)
+ return (EOPNOTSUPP);
+ return (0);
}
vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
@@ -228,6 +233,7 @@ tmpfs_mount(struct mount *mp)
tmpfs_node_ctor, tmpfs_node_dtor,
tmpfs_node_init, tmpfs_node_fini,
UMA_ALIGN_PTR, 0);
+ tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
/* Allocate the root node. */
error = tmpfs_alloc_node(tmp, VDIR, root_uid,
OpenPOWER on IntegriCloud