From nobody Thu Sep 4 02:09:47 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 4cHNGN4Xk2z66ZdB; Thu, 04 Sep 2025 02:09:48 +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 4cHNGN26RHz3GhY; Thu, 04 Sep 2025 02:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756951788; 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=5BqQrJTL1PNweVtO4+AY2eiWEAHq1A/XF6deokCSMfA=; b=bnbI6BJO8Qu6WYKoXd7iZnkmc48VOtIZCEINE3y5AGre4U7FsWDZo55ZRYvhLfNOz1BBG6 kGTuK8fIEHs3eWKCMWiNoTQRt5/jZn7xrOs1Vj68oFtTiUkE42x1eScwQu7O2Of9HG0ahR iLXOgE35g9MNNrjS624bP4lQ9XtWUU57vwd67Vog/MioHJICiyrvKQYv42mYLdJK19pOrx DXn7re9nGBcBb2MpSyiAeqZCa7Q4jx9KtL8KuI0JG+CQQtzBEeL1go84ODDrpzd6tgfNNk s1gs+3N8NdeQX8JlX631Y08hkJSh2npJQ56M+hMas5CeRBTni3hPFnuow0Hn3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756951788; 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=5BqQrJTL1PNweVtO4+AY2eiWEAHq1A/XF6deokCSMfA=; b=AaEriVpbFpEsYxP267vSfGHpcgZrYrHhGb12/KYEz8ariDPKq9O/jRhjT6IngsRCjwSQ3F Yf1OXJBawsS53ibSmZj8vKNp3u2cOI8TP2osq3R1O/zLA8iMc4JQWM4XN/zex2ZeVtSy8q aeIPRXGre6Ttyh1uaEugQi4d266ia6MAuALFoDdF6AAywmX3bBiUE1QM5U8Rrr0/T0Nunr yvXVZ/J6YmUHW1g50biJAx20Y55UTEvsMicRGjYISC4NMFGziHAbrskz7y3FvWyt6tuyfE KtLgDaKoneb6FjDFC3QrqkREji4ULFZAXkVO+NUV+H7uLgC4SUsjDWCDlvzO1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756951788; a=rsa-sha256; cv=none; b=heqmkJ0tb9ViIh7NvHKu2hAaCb2GbtyQA+O68OrETElLEBGaFM12eKU6ZtCQkln3bOnR5N qNPF9pg1edfFQKT9XG0TIJlcFt9Z0tsr3gzWqtaZvw4QLxeXN9Cr/eNJO9ZllKL+pk4cJy poX8hfe4o/+dYt/Q6VJAtQi8qHNHU5fdX96B3HOJ6S77a0ajBw9TumGUSMJA/Oq44X9U/W EKaI7wRgRz0OUdFIUXXt535fGzYXKxTEPA1RyyeSrkDY2XoLV1tyf5/BRE1/8x2TUVv7i2 4lYmhNfDHq/Q+ZEMTzrQahVCpPZNl3IMo09MAqm9RvrDN/FjCDaeZVt3zLsv0g== 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 4cHNGN16D3zk6l; Thu, 04 Sep 2025 02:09:48 +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 58429lBv012257; Thu, 4 Sep 2025 02:09:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58429loV012254; Thu, 4 Sep 2025 02:09:47 GMT (envelope-from git) Date: Thu, 4 Sep 2025 02:09:47 GMT Message-Id: <202509040209.58429loV012254@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: 6d33507ff9b8 - main - vfs: handle vfs_init() failures 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: 6d33507ff9b877f52516df00b012715b55d4e14f Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6d33507ff9b877f52516df00b012715b55d4e14f commit 6d33507ff9b877f52516df00b012715b55d4e14f Author: Kyle Evans AuthorDate: 2025-09-04 02:08:51 +0000 Commit: Kyle Evans CommitDate: 2025-09-04 02:08:51 +0000 vfs: handle vfs_init() failures Most vfs_init implementations will not fail, with the notable current exception that tmpfs_subr_init() can fail to allocate a new swap pager type, in which case we probably do not want to proceed and keep it registered. linsysfs was a potential consumer, but we opted to go a different direction and move pseudofs init/deinit over to first mount and last mount instead. Reviewed by: fuz, kib Differential Revision: https://reviews.freebsd.org/D52037 --- sys/kern/vfs_init.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 93ac001af8ad..ceda770cb714 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -399,7 +399,7 @@ vfs_register(struct vfsconf *vfc) static int once; struct vfsconf *tvfc; uint32_t hashval; - int secondpass; + int error, prevmaxconf, secondpass; if (!once) { vattr_null(&va_null); @@ -417,6 +417,7 @@ vfs_register(struct vfsconf *vfc) return (EEXIST); } + prevmaxconf = maxvfsconf; if (vfs_typenumhash != 0) { /* * Calculate a hash on vfc_name to use for vfc_typenum. Unless @@ -509,16 +510,24 @@ vfs_register(struct vfsconf *vfc) vfc->vfc_vfsops = &vfsops_sigdefer; } - if (vfc->vfc_flags & VFCF_JAIL) - prison_add_vfs(vfc); - /* * Call init function for this VFS... */ if ((vfc->vfc_flags & VFCF_SBDRY) != 0) - vfc->vfc_vfsops_sd->vfs_init(vfc); + error = vfc->vfc_vfsops_sd->vfs_init(vfc); else - vfc->vfc_vfsops->vfs_init(vfc); + error = vfc->vfc_vfsops->vfs_init(vfc); + + if (error != 0) { + maxvfsconf = prevmaxconf; + TAILQ_REMOVE(&vfsconf, vfc, vfc_list); + vfsconf_unlock(); + return (error); + } + + if ((vfc->vfc_flags & VFCF_JAIL) != 0) + prison_add_vfs(vfc); + vfsconf_unlock(); /*