From nobody Wed Dec 27 04:24:54 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 4T0JT30KXBz552sw; Wed, 27 Dec 2023 04:24:55 +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 4T0JT25Ycmz4fph; Wed, 27 Dec 2023 04:24:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703651094; 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=tzVshUeOpVhoWUOHiuB38qZ5jUZF/XfcPPMve1NV6qs=; b=HtQJQMhO5J0IS/tKDFC5f522cIrqRanZukkgImkcwBdVJOaDq3ZGADZFvD40aMDdkxfkZL mj34LBtT7ssuyRf5vED9hNb5K+NIgl24j1Zih+Pymz8S9+AdDLVjip6e1wOyyXbMsYrvMK 9xLrhsRx5oMjhtLlI8dflTYTAnWSn+PsaAr1aO10Fsq27ICZ1BxhO4Edo6XNXFKBLYwHJS DeUuXJpvaSaMX1lfK+K3n6rqzjELhuI5DqGV8l+FlwVB0655yNizKjw8RVf0OupVDhYK/7 etKBuizzfKfkJEWgpI40zrOESsXAyV42VwQcB6a0SpUeSDzBGsbSv+OB1NxcYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703651094; a=rsa-sha256; cv=none; b=Su+ig0jqNCxbQNXqG4I44JgJ7Z2hJlLl8V4GEUH0IGUmdgMBj3k/GEEZuGuRxE+lAFVzKU HcZMYionFv5Yo/hT6RFvv23OwnFaniuE1qMRURhXENsl04hC90aAeqV6/8tgdHIzi2OYiq +1YoQ6OfmWc0JGPeOwhuzg1FYNEOQFwDz5GctHJWaCyAgztPIA3DhpIWpZCrrRNzxnHaxr MTKHYbDB7hV+pkyxWdXrzQnl6yvMtWFadBOiYtb7A+oofmvDKHtO7yt31UW9gup/1rivEV FbHwUrhBe41GgqlTRtgB44iRoFuLHByFACUtM5rwSIMGuoxJBUb7F8U4nzhaGw== 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=1703651094; 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=tzVshUeOpVhoWUOHiuB38qZ5jUZF/XfcPPMve1NV6qs=; b=NBSDlMEltj1uW1Yb6HXmmF3NGEAM1bt1lM0eaRBqzwAdNCi3wGT7OvolEnVkZGN002LHks BK+oexG3lIMm8Jujp6ZUpO7JRAHUgy0MC2PmGYFn8dHWtUiOjpaCsWmUCDCfWdquSAvVod ljutQppyQi/kb11hJ5OxQe48vM/DXeyrKd15jeXEOJTnpyQHIMP5EFae0gj1JSwIAa95f+ gHpi2kKb8d/0OnopnrZv2Glnkh9xEAJaNpnAIWyZ0KhAJbfohkuNT84Eqg1BCDZ4I5rhUF tmHoY3SJqtNaQTMBN97rmSwY5/Rj/vg99vGyoZBHmGTkL1SIIXETKsWAf0f7bg== 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 4T0JT24c71z8rD; Wed, 27 Dec 2023 04:24:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BR4OsJo057120; Wed, 27 Dec 2023 04:24:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BR4Osrc057117; Wed, 27 Dec 2023 04:24:54 GMT (envelope-from git) Date: Wed, 27 Dec 2023 04:24:54 GMT Message-Id: <202312270424.3BR4Osrc057117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 97958f5d5c67 - main - netlink: simplify socket destruction 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97958f5d5c674de5d05a6b547cb1c45f8c58791b Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=97958f5d5c674de5d05a6b547cb1c45f8c58791b commit 97958f5d5c674de5d05a6b547cb1c45f8c58791b Author: Gleb Smirnoff AuthorDate: 2023-12-27 04:22:12 +0000 Commit: Gleb Smirnoff CommitDate: 2023-12-27 04:22:12 +0000 netlink: simplify socket destruction Destroy the socket at the file descriptor close(2). There is no reason to linger for any longer, there are no external references. Remove pr_detach method as nothing left to do after pr_close. Remove pr_abort method as it shall never be executed for this type of socket. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D42521 --- sys/netlink/netlink_domain.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c index 1b48ac65cec1..38f4a2dfed94 100644 --- a/sys/netlink/netlink_domain.c +++ b/sys/netlink/netlink_domain.c @@ -360,14 +360,6 @@ nl_pru_attach(struct socket *so, int proto, struct thread *td) return (0); } -static void -nl_pru_abort(struct socket *so) -{ - NL_LOG(LOG_DEBUG3, "socket %p, PID %d", so, curproc->p_pid); - MPASS(sotonlpcb(so) != NULL); - soisdisconnected(so); -} - static int nl_pru_bind(struct socket *so, struct sockaddr *sa, struct thread *td) { @@ -494,7 +486,7 @@ destroy_nlpcb_epoch(epoch_context_t ctx) static void -nl_pru_detach(struct socket *so) +nl_close(struct socket *so) { struct nl_control *ctl = atomic_load_ptr(&V_nl_ctl); MPASS(sotonlpcb(so) != NULL); @@ -563,14 +555,6 @@ nl_sockaddr(struct socket *so, struct sockaddr *sa) return (0); } -static void -nl_pru_close(struct socket *so) -{ - NL_LOG(LOG_DEBUG3, "socket %p, PID %d", so, curproc->p_pid); - MPASS(sotonlpcb(so) != NULL); - soisdisconnected(so); -} - static int nl_pru_output(struct mbuf *m, struct socket *so, ...) { @@ -766,17 +750,15 @@ nl_setsbopt(struct socket *so, struct sockopt *sopt) .pr_flags = PR_ATOMIC | PR_ADDR | PR_WANTRCVD, \ .pr_ctloutput = nl_ctloutput, \ .pr_setsbopt = nl_setsbopt, \ - .pr_abort = nl_pru_abort, \ .pr_attach = nl_pru_attach, \ .pr_bind = nl_pru_bind, \ .pr_connect = nl_pru_connect, \ - .pr_detach = nl_pru_detach, \ .pr_disconnect = nl_pru_disconnect, \ .pr_send = nl_pru_send, \ .pr_rcvd = nl_pru_rcvd, \ .pr_shutdown = nl_pru_shutdown, \ .pr_sockaddr = nl_sockaddr, \ - .pr_close = nl_pru_close + .pr_close = nl_close static struct protosw netlink_raw_sw = { .pr_type = SOCK_RAW,