From nobody Thu Sep 4 12:52:36 2025 X-Original-To: dev-commits-src-main@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 4cHfX52jV5z65xvR; Thu, 04 Sep 2025 12:52:37 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cHfX46wd1z3Ky2; Thu, 04 Sep 2025 12:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756990357; 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=2jBgdO7R4AFGLwlBnGfz8JRFsXSOH/BZql5exTNfRsg=; b=cU5eO8yaUevzLub4pYvi+TdsGMUOM+cXa3g4jH2q7RuW33+RZSHx+FcGHUkLfsi3u9F8l4 sVbiiVbnIiLEhuYtKCoIn2jHdJhB1SAZ/lC7QKrA2nSLjY22ROaY26R4UtFj5INDrJ+Vyq yZdLWBNqJJXzEafFxybFMu2z+4f7LFr4xhID9auuqNQyfgJMfebVlsLCJ4XVypbft1uemh 0APBB61cJ128inxLEhW+sG+koetMYuawXFLwESeNZ0Zva5QS62YRIIc/PIqMV/oV/9T7/O mVq5A1utFTczPynHNoryuKYIS8eSBlUjpoqqtRjfZAGqMt8NwBaYXqWnA7lSsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756990357; 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=2jBgdO7R4AFGLwlBnGfz8JRFsXSOH/BZql5exTNfRsg=; b=AuHVynbw3txLNTa5B4dgl84dVzvIX7myPoa078P8pcU2H/SvNjGwmHm1LVUf7BEywMMejT edjDt0SbOIxhI+2pFEnb2QQXMX8ZnZsGFxvkIR7dpnMGVqMoZntVDaaRF7rNv26TqImPw3 hpuJfr6mld9Y7IDw1G0mxZLS6oNwbjWoCTfI4Ze1M1zMjODt7rfck421+MGv5h1/GIONO5 sqOUgfIZOV+R+WKM60WqojDKqCBXttWUujDn+3IQvVxYjtUQkr+85gPpFgqt5ZuTJGkQLu r3jXZToU7FAcl4ahS7HW9XjomxjJnnGGrzQyQC0lQ1JPsLDRbrVyfs2Qe4vZAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756990357; a=rsa-sha256; cv=none; b=Cg7P7X2M2hHkUz8qFCjLEghRzpGP11csLMtWloIyUMR2YG9A+iP5lLgN+jomxn1yZJuJWX y2nBiRHl6yxa+h095s8JBDIsqKflyJZktzUdvjT7tO+ShD+puy8n6EXMX7RPiYhqxc/iNd YHA3PVDi3UcM4TNoe/CS4aj4B0mlI5Y0h9PnnncfUjcBRiAGtbOXKAr90wQgZ4ISdVapYq 78mRodR2wsJWye+3pUP0iQRa1FQA0AKLG4zqZQm5L8nZJJdpMAcMFpFo3YFLFuKZ8wHCPe eI6GLcvf9jmGflj2bXcsq1monxLE1z8/nI12s5jH89VOrCuLJYOpRCz5sJQXsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cHfX45yxWz13Ry; Thu, 04 Sep 2025 12:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 584Cqa1W035003; Thu, 4 Sep 2025 12:52:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 584Cqaeh035000; Thu, 4 Sep 2025 12:52:36 GMT (envelope-from git) Date: Thu, 4 Sep 2025 12:52:36 GMT Message-Id: <202509041252.584Cqaeh035000@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d3462294c1f0 - main - Revert "pseudofs: defer initialization until first mount" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3462294c1f02ca20cc1869d618bde57559f5914 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d3462294c1f02ca20cc1869d618bde57559f5914 commit d3462294c1f02ca20cc1869d618bde57559f5914 Author: Kyle Evans AuthorDate: 2025-09-04 12:48:18 +0000 Commit: Kyle Evans CommitDate: 2025-09-04 12:51:41 +0000 Revert "pseudofs: defer initialization until first mount" This reverts commit 65059dd2b6f94e570acc645be82b8ea056316459. lindebugfs does he vast majority of its pseudofs initialization nearly everywhere but pseudofs, so let's defer this to post-brsnching. --- sys/fs/pseudofs/pseudofs.c | 71 +++++-------------------------------------- sys/fs/pseudofs/pseudofs.h | 33 +++++++++----------- sys/modules/pseudofs/Makefile | 4 +-- 3 files changed, 24 insertions(+), 84 deletions(-) diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index 26a1dcd4ad39..7a4e67455214 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -40,18 +40,13 @@ #include #include #include -#include #include -#include #include #include #include #include -static int pfs_setup(struct pfs_info *pi, struct vfsconf *vfc); -static int pfs_teardown(struct pfs_info *pi, struct vfsconf *vfc); - static MALLOC_DEFINE(M_PFSNODES, "pfs_nodes", "pseudofs nodes"); SYSCTL_NODE(_vfs, OID_AUTO, pfs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, @@ -407,20 +402,10 @@ int pfs_mount(struct pfs_info *pi, struct mount *mp) { struct statfs *sbp; - int error = 0; if (mp->mnt_flag & MNT_UPDATE) return (EOPNOTSUPP); - sx_xlock(&pi->pi_mountlock); - if (pi->pi_root == NULL) - error = pfs_setup(pi, mp->mnt_vfc); - if (error == 0) - refcount_acquire(&pi->pi_mounts); - sx_xunlock(&pi->pi_mountlock); - if (error != 0) - return (error); - MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; mp->mnt_kern_flag |= MNTK_NOMSYNC; @@ -459,23 +444,10 @@ pfs_cmount(struct mntarg *ma, void *data, uint64_t flags) int pfs_unmount(struct mount *mp, int mntflags) { - struct pfs_info *pi; int error; error = vflush(mp, 0, (mntflags & MNT_FORCE) ? FORCECLOSE : 0, curthread); - if (error != 0) - return (error); - - pi = (struct pfs_info *)mp->mnt_data; - sx_xlock(&pi->pi_mountlock); - if (!refcount_release_if_not_last(&pi->pi_mounts)) { - error = pfs_teardown(pi, mp->mnt_vfc); - if (error == 0) - refcount_release(&pi->pi_mounts); - } - sx_xunlock(&pi->pi_mountlock); - return (error); } @@ -501,36 +473,11 @@ pfs_statfs(struct mount *mp, struct statfs *sbp) return (0); } -/* - * Initialize pseudofs synchronization bits. These will generally be needed - * in order to avoid problems with parallel mounting of pseudofs consumers. - */ -int -pfs_vfsinit(struct pfs_info *pi, struct vfsconf *vfc) -{ - - sx_init(&pi->pi_mountlock, "pfs mountlock"); - refcount_init(&pi->pi_mounts, 0); - return (0); -} - -int -pfs_vfsuninit(struct pfs_info *pi, struct vfsconf *vfc) -{ - - MPASS(pi->pi_root == NULL); - sx_destroy(&pi->pi_mountlock); - - if (bootverbose) - printf("%s unregistered\n", pi->pi_name); - return (0); -} - /* * Initialize a pseudofs instance */ -static int -pfs_setup(struct pfs_info *pi, struct vfsconf *vfc) +int +pfs_init(struct pfs_info *pi, struct vfsconf *vfc) { struct pfs_node *root; int error; @@ -560,20 +507,18 @@ pfs_setup(struct pfs_info *pi, struct vfsconf *vfc) /* * Destroy a pseudofs instance */ -static int -pfs_teardown(struct pfs_info *pi, struct vfsconf *vfc) +int +pfs_uninit(struct pfs_info *pi, struct vfsconf *vfc) { int error; - MPASS(pi->pi_root != NULL); - error = (pi->pi_uninit)(pi, vfc); - if (error != 0) - return (error); - pfs_destroy(pi->pi_root); pi->pi_root = NULL; pfs_fileno_uninit(pi); - return (0); + if (bootverbose) + printf("%s unregistered\n", pi->pi_name); + error = (pi->pi_uninit)(pi, vfc); + return (error); } /* diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h index e060f89b580f..2b08dcad978d 100644 --- a/sys/fs/pseudofs/pseudofs.h +++ b/sys/fs/pseudofs/pseudofs.h @@ -31,7 +31,6 @@ #ifndef _PSEUDOFS_H_INCLUDED #define _PSEUDOFS_H_INCLUDED -#include #include /* @@ -189,11 +188,9 @@ typedef int (*pfs_destroy_t)(PFS_DESTROY_ARGS); /* * pfs_info: describes a pseudofs instance * - * The pi_mutex is used to avoid using the global subr_unit lock for unrhdr, and - * the pi_mountlock is used to coordinate initialization of the consumer - * filesystem on first mount. The rest of struct pfs_info is only modified - * during pi_init() and pi_uninit() of the consumer filesystem, which are fully - * serialized. + * The pi_mutex is only used to avoid using the global subr_unit lock + * for unrhdr. The rest of struct pfs_info is only modified during + * vfs_init() and vfs_uninit() of the consumer filesystem. */ struct pfs_info { char pi_name[PFS_FSNAMELEN]; @@ -201,11 +198,9 @@ struct pfs_info { pfs_init_t pi_uninit; /* members below this line are initialized at run time */ - struct sx pi_mountlock; struct pfs_node *pi_root; struct mtx pi_mutex; struct unrhdr *pi_unrhdr; - u_int pi_mounts; }; /* @@ -254,8 +249,8 @@ int pfs_unmount (struct mount *mp, int mntflags); int pfs_root (struct mount *mp, int flags, struct vnode **vpp); int pfs_statfs (struct mount *mp, struct statfs *sbp); -int pfs_vfsinit (struct pfs_info *pi, struct vfsconf *vfc); -int pfs_vfsuninit (struct pfs_info *pi, struct vfsconf *vfc); +int pfs_init (struct pfs_info *pi, struct vfsconf *vfc); +int pfs_uninit (struct pfs_info *pi, struct vfsconf *vfc); /* * Directory structure construction and manipulation @@ -282,9 +277,9 @@ int pfs_destroy (struct pfs_node *pn); #define PSEUDOFS(name, version, flags) \ \ static struct pfs_info name##_info = { \ - .pi_name = #name, \ - .pi_init = name##_init, \ - .pi_uninit = name##_uninit, \ + #name, \ + name##_init, \ + name##_uninit, \ }; \ \ static int \ @@ -293,22 +288,22 @@ _##name##_mount(struct mount *mp) { \ } \ \ static int \ -_##name##_vfsinit(struct vfsconf *vfc) { \ - return (pfs_vfsinit(&name##_info, vfc)); \ +_##name##_init(struct vfsconf *vfc) { \ + return (pfs_init(&name##_info, vfc)); \ } \ \ static int \ -_##name##_vfsuninit(struct vfsconf *vfc) { \ - return (pfs_vfsuninit(&name##_info, vfc)); \ +_##name##_uninit(struct vfsconf *vfc) { \ + return (pfs_uninit(&name##_info, vfc)); \ } \ \ static struct vfsops name##_vfsops = { \ .vfs_cmount = pfs_cmount, \ - .vfs_init = _##name##_vfsinit, \ + .vfs_init = _##name##_init, \ .vfs_mount = _##name##_mount, \ .vfs_root = pfs_root, \ .vfs_statfs = pfs_statfs, \ - .vfs_uninit = _##name##_vfsuninit, \ + .vfs_uninit = _##name##_uninit, \ .vfs_unmount = pfs_unmount, \ }; \ VFS_SET(name##_vfsops, name, VFCF_SYNTHETIC | flags); \ diff --git a/sys/modules/pseudofs/Makefile b/sys/modules/pseudofs/Makefile index 3928c950ab70..cb92b8912c86 100644 --- a/sys/modules/pseudofs/Makefile +++ b/sys/modules/pseudofs/Makefile @@ -13,8 +13,8 @@ EXPORT_SYMS= pfs_cmount \ pfs_unmount \ pfs_root \ pfs_statfs \ - pfs_vfsinit \ - pfs_vfsuninit \ + pfs_init \ + pfs_uninit \ pfs_create_dir \ pfs_create_file \ pfs_create_link \