From nobody Sat Oct 22 00:30:20 2022 X-Original-To: dev-commits-src-all@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 4MvMgK0Cpxz4g7Sr; Sat, 22 Oct 2022 00:30:21 +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 4MvMgJ6j8Bz3lfV; Sat, 22 Oct 2022 00:30:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666398620; 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=WlU1aqZyiaCkQA5r7dFPcN1dQ/h7ZSfhIC0J78eoqs8=; b=fWUIlLpUOfiG94ABio4CVSZdH2LNe8S3z4TzHN+aw3OzK7rLGkGsNNojlNBscd/gl9w04g aoDTGmjBHdtSVZwkAxYq0/y7P7lHB9Vmc1B2sAcd19PUxnhuruD7C63enbKjZtQJC77shG I1TTUw0lO+9O1hSbQKB1OBxIy7ISD6A1y/S+eM5cz5yTIDxDtViCZhiV6ng2HpAGd5cpFe EXWDebCjLTxGeAfdo42SMGq8Pk7cZFIuq2fZt0kfxsL/Kl6xU3Wk0ZHDPYm9MNCK1K9RF7 5NCjGbSk/1SZ+th/3SNfqdsmNysl2kOdnq/cHmLzn99n+ufJZAcLEcQn10YV5Q== 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 4MvMgJ5m5NzNfP; Sat, 22 Oct 2022 00:30:20 +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 29M0UKAE086929; Sat, 22 Oct 2022 00:30:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29M0UKRs086921; Sat, 22 Oct 2022 00:30:20 GMT (envelope-from git) Date: Sat, 22 Oct 2022 00:30:20 GMT Message-Id: <202210220030.29M0UKRs086921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 15b3e3bb7efc - main - ctld: if adding a target fails, retry it on the next reload List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15b3e3bb7efcbf7c29ab76e9ea7990c17df790e6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666398620; 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=WlU1aqZyiaCkQA5r7dFPcN1dQ/h7ZSfhIC0J78eoqs8=; b=Z414Cjf1FYXXemDFVLBFQEhuoHpNfg96trBjc5ET7rCCoWNu6iQrLWCVZCNn++JKVxLhwE Di0zEASgsC22f2urSN7FLXGJQePH+zX87eQx5pdVDPEAKQ9vokwDp/CeBiiG4oCbDSeJv9 FLflYYxfzk0r8g6I6GNVkw1BW7arkQuDUwUu1IBQOIwiXNYhuChjwq//cKFykDlxiRtf2p weq+tFuPFgUrT6ZwbaSlCJlH3fC6vx2fu7KZjdfMaveSdJv7NhExdXvsTsRmomL5FEDRju 3srU5UoOfDMTN98JAzWcMiH8q+lp3eJydrGJ+STF9mBS+6UUmcjSFC4eu+EUyQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666398620; a=rsa-sha256; cv=none; b=BEiZR9IJpf9H78LOXFcypkJ6OvXTtxARSQGZSg31nS3H/31Iw6BSEnpV1T+eNfxE1tbasn OIEeA9EeCITEskNaO0vKW2gw6imzWXAXN42hW7DvCt3/xGXZS6tZ9Ike8vHEWm6G9wE2wY iver1OMiMblapnYJLlY/YVLhq/EHju8xa/m6XBPSYkFf16NLK2hlN3z94E+xrp51NqFuEV VHr+0LI5CWrvAz8jUaPrvrVYLEmJBGEWUVwzfpAwAVFhId4TPOLT6JlaFFlaV2RWgRw+uW QnyivTbaXaiktw30gzrrwRWkF77i3XIlLPfgn/g3BFeKVOtbrLfxZv/Y2bhcWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=15b3e3bb7efcbf7c29ab76e9ea7990c17df790e6 commit 15b3e3bb7efcbf7c29ab76e9ea7990c17df790e6 Author: Alan Somers AuthorDate: 2022-10-12 22:44:09 +0000 Commit: Alan Somers CommitDate: 2022-10-22 00:28:45 +0000 ctld: if adding a target fails, retry it on the next reload If the admin creates more CTL ports than kern.cam.ctl.max_ports, then adding some will fail. If he then removes some ports and does "service ctld reload", he would expect that the new ports would get added in the newly-freed port space. But they don't, because ctld assigned them port numbers during their first creation attempts. Fix this bug by removing newly created ports from ctld's internal list if the kernel rejects them for any reason. That way, a subsequent config reload will attempt to add them again, possibly with new port numbers. MFC after: 2 weeks Sponsored by: Axcient Reviewed by: jhb, mav Differential Revision: https://reviews.freebsd.org/D36974 --- usr.sbin/ctld/ctld.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 3f4bca632512..7ee381de08a7 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -2113,7 +2113,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf) /* * Now add new ports or modify existing ones. */ - TAILQ_FOREACH(newport, &newconf->conf_ports, p_next) { + TAILQ_FOREACH_SAFE(newport, &newconf->conf_ports, p_next, tmpport) { if (port_is_dummy(newport)) continue; oldport = port_find(oldconf, newport->p_name); @@ -2130,6 +2130,8 @@ conf_apply(struct conf *oldconf, struct conf *newconf) log_warnx("failed to %s port %s", (oldport == NULL) ? "add" : "update", newport->p_name); + if (oldport == NULL || port_is_dummy(oldport)) + port_delete(newport); /* * XXX: Uncomment after fixing the root cause. *