From owner-svn-src-stable-8@freebsd.org Sat May 6 16:06:34 2017 Return-Path: Delivered-To: svn-src-stable-8@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD2EBD615B2; Sat, 6 May 2017 16:06:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7049F1861; Sat, 6 May 2017 16:06:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46G6XQ4031100; Sat, 6 May 2017 16:06:33 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46G6X9Y031098; Sat, 6 May 2017 16:06:33 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201705061606.v46G6X9Y031098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 6 May 2017 16:06:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r317883 - stable/8/sys/fs/tmpfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 16:06:35 -0000 Author: ian Date: Sat May 6 16:06:33 2017 New Revision: 317883 URL: https://svnweb.freebsd.org/changeset/base/317883 Log: MFC r230208, r230252, r234346: Add nfs export support to tmpfs(5) Return EOPNOTSUPP since we only support update mounts for NFS export. 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. Modified: stable/8/sys/fs/tmpfs/tmpfs.h stable/8/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/fs/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs.h Sat May 6 13:28:42 2017 (r317882) +++ stable/8/sys/fs/tmpfs/tmpfs.h Sat May 6 16:06:33 2017 (r317883) @@ -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) Modified: stable/8/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vfsops.c Sat May 6 13:28:42 2017 (r317882) +++ stable/8/sys/fs/tmpfs/tmpfs_vfsops.c Sat May 6 16:06:33 2017 (r317883) @@ -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,