aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2017-05-06 16:06:33 +0000
committerIan Lepore <ian@FreeBSD.org>2017-05-06 16:06:33 +0000
commit7e8a52266eae4f3980b6cba8719bee8aeb4a8439 (patch)
tree72ff72baa25375e6fda750df3b35e3295ea2b633
parent13bd51168655574f4ea1561d101670833f82e2e9 (diff)
Notes
-rw-r--r--sys/fs/tmpfs/tmpfs.h3
-rw-r--r--sys/fs/tmpfs/tmpfs_vfsops.c16
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h
index 85eaee129635c..fc59bb84108ef 100644
--- a/sys/fs/tmpfs/tmpfs.h
+++ b/sys/fs/tmpfs/tmpfs.h
@@ -389,6 +389,9 @@ struct tmpfs_mount {
* tmpfs_pool.c. */
uma_zone_t tm_dirent_pool;
uma_zone_t tm_node_pool;
+
+ /* Read-only status. */
+ int tm_ronly;
};
#define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock)
#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock)
diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c
index ae96c8296fb5e..4db3d348e6570 100644
--- a/sys/fs/tmpfs/tmpfs_vfsops.c
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c
@@ -81,6 +81,10 @@ static const char *tmpfs_opts[] = {
NULL
};
+static const char *tmpfs_updateopts[] = {
+ "from", "export", NULL
+};
+
/* --------------------------------------------------------------------- */
static int
@@ -149,10 +153,13 @@ tmpfs_mount(struct mount *mp)
return (EINVAL);
if (mp->mnt_flag & MNT_UPDATE) {
- /* XXX: There is no support yet to update file system
- * settings. Should be added. */
-
- 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);
@@ -224,6 +231,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,