From nobody Wed Jun 10 04:01:02 2026 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 4gZsWy31Qgz6gvDK for ; Wed, 10 Jun 2026 04:01:02 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gZsWy2DNQz3w2q for ; Wed, 10 Jun 2026 04:01:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781064062; 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=j1JhmSHEIEWLbGlgsgAcQoBmH64X/4BtonGccZNHzJ8=; b=qiM/3m0q9tdndvzC4QBmbCqK09jbELH+mCAoL8EmjMtCEA87r3uUrk/V6xhDMAuH7SHHjR w83kHokcu2nuxRDx0KFct3P/ovBZNUAJ7dojwLm9gZiSwYog4jzTJpnl7Wra1oxJQ6VPaT KT+RENKuoi0gm23V+HvQ+IGIH7X68XOXj1oXTCva2uOscMKYYKl0HaWHuKxlJx9iCWxKuQ O4rbkPFWHUev2k9uMe1WxlPinGQzBz1rmMnrY/ggYb6nficKfnOfl6mXZxOPIFvnSxCpCO YzxzEPhE8YiDHpmHb8yPVVECip1l+xjiEoRn/7egwlnwLJOvWdiuVpcA5TvYvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781064062; a=rsa-sha256; cv=none; b=iTdL/J/sqm9bK6PKJaU6E2P4VRjOl6yoULFbiRyZbEfEpWEva1SLz5uKCwkynAgvypBuEo 0s2lehtu5/G3QnjPC+1Mer4ExE8io0jDdnrz+2n2m1IY1NTiacpOb3LmzY0SB8FwiJfCPn rmqDV5DM91ZFeyKi17QBKQnf9tACpv4V9Yhu9Re2iKtYSZkGE99ak301ji8T3t1AwXiAK6 rVm8i2lu/C8Srmsh0lEuJ7OvY8yvijiT2sRpxCb1lSD8tCQ2MDJqz19b70ns0ueidH6Yha 41/s72bPVw+78HYBXYkSx2lu5mlC06O+cLGIfpkCIfJ52Ntqp9qpUzo5036YAA== 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=1781064062; 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=j1JhmSHEIEWLbGlgsgAcQoBmH64X/4BtonGccZNHzJ8=; b=f8MFRh0AQY2gE5QFqTpbvUv3p6NEJ+P5gLeyraeElV6mtY/3GtENcR4ghRg2Nazufc29ZN D3sb8xGXPos/75sMPlkFMOnqD4bh3XWPdK/WiWt9mKApl9aL2NTyX0e26HwNYVnBU/4LAR B+1Sz8MNHkTKu/nPl5bLK5eBtLcwrkkU7AT3z3x/3xWo9Tav890auO2g8gPRrqaozvzgTc f4Po7ryp6c/7YEF+0SRCbuzxtfOunmxBsJ4zflo08PDephSkdwmS/vI+F57UGDaS1GABEB gUYWcd0SQBNEHjlOdQc6VdtRdcrM0QEReIaqG1Sm1jCnD/FAGjoTEfPPJVk/lw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gZsWy1jKxz1430 for ; Wed, 10 Jun 2026 04:01:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26765 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 10 Jun 2026 04:01:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 3129ecee97c1 - stable/14 - ctld: kernel-sourced portal groups are not dummies 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 3129ecee97c1405fbb6eeab2e8b906b096eab1c9 Auto-Submitted: auto-generated Date: Wed, 10 Jun 2026 04:01:02 +0000 Message-Id: <6a28e17e.26765.1b8f5325@gitrepo.freebsd.org> The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3129ecee97c1405fbb6eeab2e8b906b096eab1c9 commit 3129ecee97c1405fbb6eeab2e8b906b096eab1c9 Author: Kyle Evans AuthorDate: 2026-04-28 20:51:50 +0000 Commit: Kyle Evans CommitDate: 2026-06-10 04:00:45 +0000 ctld: kernel-sourced portal groups are not dummies The current and historical versions of ctld would flag our initial set of kernel ports as dummies, because their portal groups were empty since portals come from the configuration on-disk. As a result, we would never try to remove a kernel port at startup that didn't exist in the configuration (possibly a feature if you wanted concurrent ctld(8)), and we would always try to port->kernel_add() on ports in the configuration (even if they actually did have an existing kernel port). Flag these portal groups as kernel groups so that we avoid trying to add ports that already exist. It may be the case that the kernel_remove() loop in conf::apply() needs to do something other than the current `oldport->is_dummy()` to avoid removing ports that it isn't supposed to be managing, but that wuld also seem to apply to LUNs that would be removed today. Reviewed by: jhb (cherry picked from commit d9c0594191f5c45d7f3c737350321ee59bfce9bf) --- usr.sbin/ctld/ctld.cc | 9 +++++++++ usr.sbin/ctld/ctld.hh | 1 + usr.sbin/ctld/kernel.cc | 2 ++ 3 files changed, 12 insertions(+) diff --git a/usr.sbin/ctld/ctld.cc b/usr.sbin/ctld/ctld.cc index c44c3726e74e..05734cde5a49 100644 --- a/usr.sbin/ctld/ctld.cc +++ b/usr.sbin/ctld/ctld.cc @@ -1136,11 +1136,20 @@ port_delete(struct port *port) free(port); } +/* + * Foreign portal groups (which only redirect to other targets), and portal + * groups without any active portals are considered dummies and ports belonging + * to such groups are ignored. However, portal groups that exist in the kernel + * prior to ctld starting will contain real ports but no portals, so these are + * never considered dummies. + */ bool port_is_dummy(struct port *port) { if (port->p_portal_group) { + if (port->p_portal_group->pg_kernel) + return (false); if (port->p_portal_group->pg_foreign) return (true); if (TAILQ_EMPTY(&port->p_portal_group->pg_portals)) diff --git a/usr.sbin/ctld/ctld.hh b/usr.sbin/ctld/ctld.hh index b1757f98ac81..a132965cd235 100644 --- a/usr.sbin/ctld/ctld.hh +++ b/usr.sbin/ctld/ctld.hh @@ -117,6 +117,7 @@ struct portal_group { struct auth_group *pg_discovery_auth_group; int pg_discovery_filter; bool pg_foreign; + bool pg_kernel; bool pg_unassigned; TAILQ_HEAD(, portal) pg_portals; TAILQ_HEAD(, port) pg_ports; diff --git a/usr.sbin/ctld/kernel.cc b/usr.sbin/ctld/kernel.cc index fdd290988ce0..809205c176ed 100644 --- a/usr.sbin/ctld/kernel.cc +++ b/usr.sbin/ctld/kernel.cc @@ -577,6 +577,8 @@ retry_port: log_warnx("portal_group_new failed"); continue; } + + pg->pg_kernel = true; } pg->pg_tag = port->cfiscsi_portal_group_tag; cp = port_new(conf, targ, pg);