From nobody Sun May 24 16:15:10 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gNkcv0RMfz6ddrY for ; Sun, 24 May 2026 16:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gNkct70Hjz3MHx for ; Sun, 24 May 2026 16:15:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779639311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Uke3bCGH50Xa+vOhJ8KPVMrHWGHLoQk4BCGP6IUQ1Y0=; b=y31qSRdENacPpg+AeumgSNYCCEXyLeC1NJvIB2hkitrFbpLnygpIWzf6Jz7swzjgw3Rwuw Usk7CftMCjHlPg7PX9CJ8cnG/5lyGbJlF//JEy3EDDEYRg4/KfPXMlxcd0djJ0VzAhM0Iv gpyn1gLlcUbb6+rMmAomhej8fr2XZEjRJ7om3y8SqMtOl6WSSKGfgKiPBR4To3brtFxh5Q h/98GaUkaEpLjqqe/9GIqWg0WGUpp8mJapVeScY5aWDgPPgHZ8qs8G5cQURFT+3+ver/J0 TmxwsUQB876zolzwHpNHAZyZBiu1l6lUX7UFfDh4caeQPHu4vts11MpnlWqI+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779639311; a=rsa-sha256; cv=none; b=xrFYnUwQzOC4LuYd8foLqY7Yb4Hcu3608hSWKLEKEW08Zlt4vViJpFBSB6SO8qkv6F0Aj8 1KYLbE5T+h87R2/DZopNmAS3UxHE8veTsUcqlP9i1iVQ8HRTZHHY3LSF16KXr3otbtHrcp qqFxR5O2/3+2FxyPiAY3B0fCDW/Tr6q9jAn3ldYgfZUQ7669QMEF4MWzyPOO/Y9xQM8+Df 6Y0edv3YA6aXdxVkc3wIwjxcEdge0/CRi1YV9SZo1GSGrY4XHBufHdn3gYsNtHrkGiH4hx ZdubWyg7W6sWmPoIV79MG8EdT9mUPkktAXeoFkuCJ9tywafhca6o2D+vbiE+ow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779639311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Uke3bCGH50Xa+vOhJ8KPVMrHWGHLoQk4BCGP6IUQ1Y0=; b=drjXbxLQzwlzfTm+zHcvg/r3n2oOldqlUtuFqVGW/nLCo2z4+F42DeOvkEVYZInWxOmyHg fkfOmJd0fLRDCjyGP26wN/TtCJlVp77WlL0xHRKri0ZlA+mys805xgkEvnocWrIUug1S18 a2EhfG8RbFT+prL3fkkRqJaBPLtdt7C1JKqKwGCrj4cZgvkzKPV1KtXe6wWNJCakETrVT/ ih/EQ+20xqMrq8I+L+qQA6Xmhf9JC3UUO0ZPZMqR3W/x3Ga4AUwFT00cCokHhFvyzT/ZVi 6ZzdBtoLW/Z4ydbaZ+Jju5QTrgT1FwJELPzKK0fpdS/DmLAEZsm2F9ceY7GcDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gNkct6FTxz1258 for ; Sun, 24 May 2026 16:15:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30e37 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 24 May 2026 16:15:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 0f4fd69ee282 - stable/15 - tmpfs: Overhaul option handling on remount List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 0f4fd69ee282b7ab5f23d0a4d3e57ab1ef6ec26c Auto-Submitted: auto-generated Date: Sun, 24 May 2026 16:15:10 +0000 Message-Id: <6a13240e.30e37.687e8170@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=0f4fd69ee282b7ab5f23d0a4d3e57ab1ef6ec26c commit 0f4fd69ee282b7ab5f23d0a4d3e57ab1ef6ec26c Author: Dag-Erling Smørgrav AuthorDate: 2026-05-19 06:54:28 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-24 16:14:39 +0000 tmpfs: Overhaul option handling on remount On remount, we must accept all the same options as on initial mount. For parameters which we're unable to modify on the fly, fail only if the new value is different from the existing one. PR: 295096 MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D57044 (cherry picked from commit 1cfc208a07b64a64377a4f8fe51c28f588a929cf) --- sys/fs/tmpfs/tmpfs_vfsops.c | 100 +++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 38 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 431893b77bb9..5a9b9782b9da 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -93,10 +93,6 @@ static const char *tmpfs_opts[] = { "export", "union", "nonc", "nomtime", "nosymfollow", "pgread", NULL }; -static const char *tmpfs_updateopts[] = { - "from", "easize", "export", "nomtime", "size", "nosymfollow", NULL -}; - static int tmpfs_update_mtime_lazy_filter(struct vnode *vp, void *arg) { @@ -325,6 +321,7 @@ tmpfs_mount(struct mount *mp) sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node)); struct tmpfs_mount *tmp; struct tmpfs_node *root; + struct vfsoptlist *opts; int error; bool nomtime, nonc, pgread; /* Size counters. */ @@ -338,44 +335,71 @@ tmpfs_mount(struct mount *mp) struct vattr va; - if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts)) + opts = mp->mnt_optnew; + if (vfs_filteropt(opts, tmpfs_opts)) return (EINVAL); if (mp->mnt_flag & MNT_UPDATE) { - /* Only support update mounts for certain options. */ - if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) - return (EOPNOTSUPP); tmp = VFS_TO_TMPFS(mp); - if (vfs_getopt_size(mp->mnt_optnew, "size", &size_max) == 0) { - /* - * On-the-fly resizing is not supported (yet). We still - * need to have "size" listed as "supported", otherwise - * trying to update fs that is listed in fstab with size - * parameter, say trying to change rw to ro or vice - * versa, would cause vfs_filteropt() to bail. - */ - if (size_max != tmp->tm_size_max) - return (EOPNOTSUPP); - } - if (vfs_getopt_size(mp->mnt_optnew, "easize", &ea_max_size) == 0) { + + /* + * These options cannot (yet) be modified on the fly, but + * mount(8) will still pass them when remounting, so we + * will silently ignore them as long as the value is + * unchanged. + */ + if (vfs_scanopt(opts, "gid", "%d", &root_gid) == 1 && + root_gid != tmp->tm_root->tn_gid) + return (EOPNOTSUPP); + if (vfs_scanopt(opts, "uid", "%d", &root_uid) == 1 && + root_uid != tmp->tm_root->tn_uid) + return (EOPNOTSUPP); + if (vfs_scanopt(opts, "mode", "%ho", &root_mode) == 1 && + (root_mode & S_IFMT) != (tmp->tm_root->tn_mode & S_IFMT)) + return (EOPNOTSUPP); + if (vfs_getopt_size(opts, "inodes", &nodes_max) == 0 && + nodes_max != 0 && nodes_max != tmp->tm_nodes_max) + return (EOPNOTSUPP); + if (vfs_getopt_size(opts, "size", &size_max) == 0 && + size_max != 0 && size_max != tmp->tm_size_max) + return (EOPNOTSUPP); + if (vfs_getopt_size(opts, "maxfilesize", &maxfilesize) == 0 && + maxfilesize != 0 && maxfilesize != tmp->tm_maxfilesize) + return (EOPNOTSUPP); + if (tmp->tm_nonc != + (vfs_getopt(opts, "nonc", NULL, NULL) == 0)) + return (EOPNOTSUPP); + if (tmp->tm_pgread != + (vfs_getopt(opts, "pgread", NULL, NULL) == 0)) + return (EOPNOTSUPP); + + /* + * These options can be modified. + */ + if (vfs_getopt_size(opts, "easize", &ea_max_size) != 0) tmp->tm_ea_memory_max = ea_max_size; - } - if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) && - !tmp->tm_ronly) { + tmp->tm_nomtime = (vfs_getopt(opts, "nomtime", NULL, 0) == 0); + + /* + * Handle read-write to read-only or vice versa. + */ + if (vfs_flagopt(opts, "ro", NULL, 0) && !tmp->tm_ronly) { /* RW -> RO */ return (tmpfs_rw_to_ro(mp)); - } else if (!vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) && - tmp->tm_ronly) { + } + if (!vfs_flagopt(opts, "ro", NULL, 0) && tmp->tm_ronly) { /* RO -> RW */ tmp->tm_ronly = 0; MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_RDONLY; MNT_IUNLOCK(mp); } - tmp->tm_nomtime = vfs_getopt(mp->mnt_optnew, "nomtime", NULL, - 0) == 0; + + /* + * Check if fast path lookup is still supported. + */ MNT_ILOCK(mp); - if ((mp->mnt_flag & MNT_UNION) == 0) { + if (!tmp->tm_nonc && (mp->mnt_flag & MNT_UNION) == 0) { mp->mnt_kern_flag |= MNTK_FPLOOKUP; } else { mp->mnt_kern_flag &= ~MNTK_FPLOOKUP; @@ -391,25 +415,25 @@ tmpfs_mount(struct mount *mp) return (error); if (mp->mnt_cred->cr_ruid != 0 || - vfs_scanopt(mp->mnt_optnew, "gid", "%d", &root_gid) != 1) + vfs_scanopt(opts, "gid", "%d", &root_gid) != 1) root_gid = va.va_gid; if (mp->mnt_cred->cr_ruid != 0 || - vfs_scanopt(mp->mnt_optnew, "uid", "%d", &root_uid) != 1) + vfs_scanopt(opts, "uid", "%d", &root_uid) != 1) root_uid = va.va_uid; if (mp->mnt_cred->cr_ruid != 0 || - vfs_scanopt(mp->mnt_optnew, "mode", "%ho", &root_mode) != 1) + vfs_scanopt(opts, "mode", "%ho", &root_mode) != 1) root_mode = va.va_mode; - if (vfs_getopt_size(mp->mnt_optnew, "inodes", &nodes_max) != 0) + if (vfs_getopt_size(opts, "inodes", &nodes_max) != 0) nodes_max = 0; - if (vfs_getopt_size(mp->mnt_optnew, "size", &size_max) != 0) + if (vfs_getopt_size(opts, "size", &size_max) != 0) size_max = 0; - if (vfs_getopt_size(mp->mnt_optnew, "maxfilesize", &maxfilesize) != 0) + if (vfs_getopt_size(opts, "maxfilesize", &maxfilesize) != 0) maxfilesize = 0; - if (vfs_getopt_size(mp->mnt_optnew, "easize", &ea_max_size) != 0) + if (vfs_getopt_size(opts, "easize", &ea_max_size) != 0) ea_max_size = 0; - nonc = vfs_getopt(mp->mnt_optnew, "nonc", NULL, NULL) == 0; - nomtime = vfs_getopt(mp->mnt_optnew, "nomtime", NULL, NULL) == 0; - pgread = vfs_getopt(mp->mnt_optnew, "pgread", NULL, NULL) == 0; + nonc = vfs_getopt(opts, "nonc", NULL, NULL) == 0; + nomtime = vfs_getopt(opts, "nomtime", NULL, NULL) == 0; + pgread = vfs_getopt(opts, "pgread", NULL, NULL) == 0; /* Do not allow mounts if we do not have enough memory to preserve * the minimum reserved pages. */