From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 30 17:24:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D9E9A82; Tue, 30 Oct 2012 17:24:27 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFA2C8FC0A; Tue, 30 Oct 2012 17:24:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9UHOQIe038733; Tue, 30 Oct 2012 17:24:26 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9UHOQEK038730; Tue, 30 Oct 2012 17:24:26 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201210301724.q9UHOQEK038730@svn.freebsd.org> From: Alfred Perlstein Date: Tue, 30 Oct 2012 17:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r242368 - stable/9/sys/fs/tmpfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2012 17:24:27 -0000 Author: alfred Date: Tue Oct 30 17:24:26 2012 New Revision: 242368 URL: http://svn.freebsd.org/changeset/base/242368 Log: MFC: Allow NFS exports of tmpfs. r234346 Approved by: kevlo, kib Modified: stable/9/sys/fs/tmpfs/tmpfs.h stable/9/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/9/sys/fs/tmpfs/tmpfs.h Tue Oct 30 17:05:47 2012 (r242367) +++ stable/9/sys/fs/tmpfs/tmpfs.h Tue Oct 30 17:24:26 2012 (r242368) @@ -387,6 +387,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/9/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/9/sys/fs/tmpfs/tmpfs_vfsops.c Tue Oct 30 17:05:47 2012 (r242367) +++ stable/9/sys/fs/tmpfs/tmpfs_vfsops.c Tue Oct 30 17:24:26 2012 (r242368) @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = { NULL }; +static const char *tmpfs_updateopts[] = { + "from", "export", NULL +}; + /* --------------------------------------------------------------------- */ static int @@ -193,10 +197,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); @@ -269,6 +276,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,