From nobody Wed May 08 13:07:49 2024 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 4VZFn14bxyz5J67s; Wed, 08 May 2024 13:07:49 +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 4VZFn12l8Wz4RL3; Wed, 8 May 2024 13:07:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715173669; 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=LgGe4Wmk/CN54WFfMHdZ9zyl1bT4KUb3V7AyxhRLo9Y=; b=EpmbQaXNqGRLkubrpMOrjCQU77zADasP4yGfxCU+YFyRTXA57YsgO1PZLYu3C0ERg1VmYe tG/Z/5LQ4C9m5n5xlLylTMGcZ/I7yosMvJqszEb9kim2VRcA4Ds8fXMhpLjkPXZ9ze4rhB 863fLt4PTlLDPGQMMFicSLVRKtUg9nPNXc3KYrIXEtuJ3tYHWWNH2k9/mR+VM3GpV5fJdc B7/ZrHDNQnBGMPCajT4cjz/8Ma0Au2QJ40T5c8sb8F7FbBzKBTBgfIzu13uY0+dEOr8oEI lSwj6+TXHln/jGZ6Neeq3xcvSnROYN1Mf/5ssXL8si1vo6rFk3fVwtWuUnaZCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715173669; a=rsa-sha256; cv=none; b=E3l2/ssukWnJZfFI2nBOTxppSlqORrlrHhTQPAV8QHpo8hkxoWy+Ugt89JKRXq+oDk6llV TTgPADxZfEdOzN1bcRufvByekrhJZTsWEE4pLyvIoCudTICe6NQYPuB+yeomPZoVuSVXW6 cTMTFKubZ8hNZSknrJ6eSBHxp4WoWJlmGU64QleaiHY50nOBqDlzv4HWdGySIgfQNL+YRS KjlBXzIoQfuLXwO8QzBewUdWW4S7ND/unfghdo+1WHWHXPP/FtdV5koGvSl4gNcFl4O0o7 H30A4jKT0xYwgj3e+rkfkcU+iHBLGK0ZUzQcMIuvKAKCUTySJie+t1BhBK7N7w== 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=1715173669; 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=LgGe4Wmk/CN54WFfMHdZ9zyl1bT4KUb3V7AyxhRLo9Y=; b=XCZvsBCTXjRaoqCfocbF7DnB9xu9AVPjTRakGHr+q0rlx6CuS57jPWEMndZg/vpcaCPcaj +QpE4J2jILZsz+rzO+G6gw1H8vQwhkiORnEvWjfGt4tpNlfg5Ceh9AZRMJ+5WBV9l2LwaK GJV/pTNXMLdUTdmljaWeSQqCYTGBi3N719a3v2iIU46uH7h/sJbeIiGjoFNNI2HAWhtDqZ E6cldcMoQbPt9YynbPTqABQUkU+6nZjwQ3nSQCMO0yBNSsPPaHoytBkJkqVmb8PRUksJVp PVr1uGphF4zTmkz58yOejJv5ika5q42/hixT9Xj7vznPFT4w2xMaXKKco0EtOg== 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 4VZFn12JvBzR1F; Wed, 8 May 2024 13:07:49 +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 448D7nDq080480; Wed, 8 May 2024 13:07:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 448D7nQI080477; Wed, 8 May 2024 13:07:49 GMT (envelope-from git) Date: Wed, 8 May 2024 13:07:49 GMT Message-Id: <202405081307.448D7nQI080477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a3ca254e6986 - stable/14 - ng_pipe: Remove node when all hooks are disconnected 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a3ca254e698698cfa130770f3c5c12f7fd9b5685 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a3ca254e698698cfa130770f3c5c12f7fd9b5685 commit a3ca254e698698cfa130770f3c5c12f7fd9b5685 Author: Martin Vahlensieck AuthorDate: 2024-04-17 18:51:40 +0000 Commit: Mark Johnston CommitDate: 2024-05-08 13:06:16 +0000 ng_pipe: Remove node when all hooks are disconnected This is the behavior described in the man page. Signed-off-by: Martin Vahlensieck Discussed with: glebius Reviewed by: markj MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1181 (cherry picked from commit bb2ab7a374b9d81f8368acc506c9700af20a22d6) --- sys/netgraph/ng_pipe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/netgraph/ng_pipe.c b/sys/netgraph/ng_pipe.c index c2424e3db48a..7afaf24f5914 100644 --- a/sys/netgraph/ng_pipe.c +++ b/sys/netgraph/ng_pipe.c @@ -936,6 +936,7 @@ ngp_disconnect(hook_p hook) struct hookinfo *const hinfo = NG_HOOK_PRIVATE(hook); struct ngp_fifo *ngp_f; struct ngp_hdr *ngp_h; + priv_p priv; KASSERT(hinfo != NULL, ("%s: null info", __FUNCTION__)); hinfo->hook = NULL; @@ -962,6 +963,12 @@ ngp_disconnect(hook_p hook) if (hinfo->ber_p) free(hinfo->ber_p, M_NG_PIPE); + /* Destroy the node if all hooks are disconnected */ + priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); + + if (priv->upper.hook == NULL && priv->lower.hook == NULL) + ng_rmnode_self(NG_HOOK_NODE(hook)); + return (0); }