From nobody Wed Mar 01 23:30:31 2023 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 4PRr7q2rmKz3vWGK; Wed, 1 Mar 2023 23:30:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PRr7q2CrZz3Q0N; Wed, 1 Mar 2023 23:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677713431; 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=u6rdN0sKK3ZyiMCmqf566B84WnsvbuUt4C3eh2dhTT4=; b=uj0dnx6aPT1O0i5KABuYjiQ8zpqRGg0jX7vNtzePRX87RH+CKHYCYDUL0l560d1U1oRHg2 PTetlzRK+Chz9awDQHE4qrE79Xxp6HUB6PRgV64Dtaii9VT3KU5yMyQJ8CvDx6cvdqi2lM ohY8qadzZXZs43WpPRGhPOIaTrQkMQPWCYskEAlQasz/kJcHwJZAvRxtnOJX/CSiZ4orDW B2qmDIwfLdNTd8wqgewCBA1hZx5XKW0v4z5c+Ptlxr68c1M4JVAuQAI6v+WD3Tl3NZoH2M 7xZIBr1ziQDp4cKseZ0Kbep55fc3ekIMNLkhSCmrZI4kGMetCFNb7euLiHuW5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677713431; 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=u6rdN0sKK3ZyiMCmqf566B84WnsvbuUt4C3eh2dhTT4=; b=iQACjKgJjwpk5+eQ/SObPKUCNjDglKVo8OkW6aL6dhqAVd9RMrULJ/rsW1BPuhmkTG3hPi uDmg9CHPPzvgAsoxowOnWSovdur4iaFGPNa8I1P5Pu3v1Y/p0lcosnFXHAc4ktk858FaI0 gSR/yVEa/DC8ttVmBmyF8gwfIsajxYH8VfNEh+S/oBhWy+2snVUIShfx12OAr4z0JiZ2oR Wn0deby0hAyuaDPuufMxnuBXBE+aecietsL5TTrEMd0EdQw28/O1luVV4KsHOtrHI7L7r7 h3M+ljmI5nhmrvQBq5MoMW5X63BHLuZND2YOzIy0apQBsoV3jQ6wFhcZvF+BJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677713431; a=rsa-sha256; cv=none; b=cvOkhgLdpUs8GoULpf8o35KfmnHjsuSVvkaLXp1WEryyYyPcbVQ2ed+eYAxO5k5Y+cT5Jb SaB+y0dDeHVOJWuMRgJ36LGm8rgckxlZutY7odl6/HXvFOqlJdfQcOKTA2AEmFHiSHjJrd xYRa7d7j78kpEKepbJHesV4C/lZKnnu3RCpeX92zIb7cldQ2Hti+X5fPDz9IabW3HiEdFA Cnl/R/6jgMb2RT+v7PLzxNVfSxYfO/WnLAEpyo7ugBbYZZDFUTZALYlfvvBSlQ3nGCK+cf SbRZTLWDiqiChtqrpPcgSSMWsVjd6+ZlF3fNjbVEXLd/gd2Rzcx4i0/4Wgocnw== 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 4PRr7q1GdGzsnN; Wed, 1 Mar 2023 23:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 321NUVBJ084574; Wed, 1 Mar 2023 23:30:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 321NUVRb084573; Wed, 1 Mar 2023 23:30:31 GMT (envelope-from git) Date: Wed, 1 Mar 2023 23:30:31 GMT Message-Id: <202303012330.321NUVRb084573@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 57ff348804f9 - main - svc_rpcsec_gss.c: Separate out the non-vnet initialization 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57ff348804f98d956f2e203b665de5a8989dbf8c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=57ff348804f98d956f2e203b665de5a8989dbf8c commit 57ff348804f98d956f2e203b665de5a8989dbf8c Author: Rick Macklem AuthorDate: 2023-03-01 23:29:25 +0000 Commit: Rick Macklem CommitDate: 2023-03-01 23:29:25 +0000 svc_rpcsec_gss.c: Separate out the non-vnet initialization Without this patch, a single initialization function was used to initialize both the vnet'd and non-vnet'd data. This patch separates out the non-vnet'd initializations into a separate function invoked by SYSINIT(). This avoids use of IS_DEFAULT_VNET() in the initialization functions and also configures the non-vnet'd initialization function to be called first, although ordering is not currently needed. Reviewed by: glebius MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D38749 --- sys/rpc/rpcsec_gss/svc_rpcsec_gss.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c b/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c index 03e185bd912b..132d7fb8c0f4 100644 --- a/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c +++ b/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c @@ -205,6 +205,25 @@ KGSS_VNET_DEFINE_STATIC(uint32_t, svc_rpc_gss_next_clientid) = 1; static void svc_rpc_gss_init(void *unused __unused) +{ + + svc_auth_reg(RPCSEC_GSS, svc_rpc_gss, rpc_gss_svc_getcred); + sx_init(&svc_rpc_gss_lock, "gsslock"); +} +SYSINIT(svc_rpc_gss_init, SI_SUB_VFS, SI_ORDER_ANY, + svc_rpc_gss_init, NULL); + +static void +svc_rpc_gss_cleanup(void *unused __unused) +{ + + sx_destroy(&svc_rpc_gss_lock); +} +SYSUNINIT(svc_rpc_gss_cleanup, SI_SUB_VFS, SI_ORDER_ANY, + svc_rpc_gss_cleanup, NULL); + +static void +svc_rpc_gss_vnetinit(void *unused __unused) { int i; @@ -214,26 +233,20 @@ svc_rpc_gss_init(void *unused __unused) for (i = 0; i < svc_rpc_gss_client_hash_size; i++) TAILQ_INIT(&KGSS_VNET(svc_rpc_gss_client_hash)[i]); TAILQ_INIT(&KGSS_VNET(svc_rpc_gss_clients)); - if (IS_DEFAULT_VNET(curvnet)) { - svc_auth_reg(RPCSEC_GSS, svc_rpc_gss, rpc_gss_svc_getcred); - sx_init(&svc_rpc_gss_lock, "gsslock"); - } } -VNET_SYSINIT(svc_rpc_gss_init, SI_SUB_VNET_DONE, SI_ORDER_ANY, - svc_rpc_gss_init, NULL); +VNET_SYSINIT(svc_rpc_gss_vnetinit, SI_SUB_VNET_DONE, SI_ORDER_ANY, + svc_rpc_gss_vnetinit, NULL); static void -svc_rpc_gss_cleanup(void *unused __unused) +svc_rpc_gss_vnet_cleanup(void *unused __unused) { mem_free(KGSS_VNET(svc_rpc_gss_client_hash), sizeof(struct svc_rpc_gss_client_list) * svc_rpc_gss_client_hash_size); - if (IS_DEFAULT_VNET(curvnet)) - sx_destroy(&svc_rpc_gss_lock); } -VNET_SYSUNINIT(svc_rpc_gss_cleanup, SI_SUB_VNET_DONE, SI_ORDER_ANY, - svc_rpc_gss_cleanup, NULL); +VNET_SYSUNINIT(svc_rpc_gss_vnet_cleanup, SI_SUB_VNET_DONE, SI_ORDER_ANY, + svc_rpc_gss_vnet_cleanup, NULL); bool_t rpc_gss_set_callback(rpc_gss_callback_t *cb)