From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 208B45A0271 for ; Tue, 7 Nov 2023 03:43:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1699324975; bh=ukZK4MJQiVbFiLw2bctJG1wANuwYXjYeMrp1/UwoQgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fL+WHqs58uUmPlrxaaSB3lPj8oA2iIoJSJJb3qYYz+cl5MjngKAFaFpRizHTsF0O+ qJrKJsKIgYMUff7EtAHCqss5JRzLUj/lPDAn+b4F+Nc8yVfeT6uhS70499HJviP95X tPGPWVKyRKgyUa4PDY2w/hmFi2Nqg/of0vKC0w3c= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4SPXZR1d2Cz4xSn; Tue, 7 Nov 2023 13:42:55 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 01/11] tcp_splice: Remove redundant tcp_splice_epoll_ctl() Date: Tue, 7 Nov 2023 13:42:40 +1100 Message-ID: <20231107024250.2290959-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231107024250.2290959-1-david@gibson.dropbear.id.au> References: <20231107024250.2290959-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: P54BDQC6R2CVVH7KP5AM4234XANP6T4E X-Message-ID-Hash: P54BDQC6R2CVVH7KP5AM4234XANP6T4E X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: tcp_splice_conn_update() calls tcp_splice_epoll_ctl() twice: first ignoring the return value, then checking it. This serves no purpose. If the first call succeeds, the second call will do exactly the same thing again, since nothing has changed in conn. If the first call fails, then tcp_splice_epoll_ctl() itself will EPOLL_CTL_DEL both fds, meaning when the second call tries to EPOLL_CTL_MOD them it will necessarily fail. It appears that this duplication was introduced by accident in an otherwise unrelated patch. Fixes: bb708111 ("treewide: Packet abstraction with mandatory boundary checks") Signed-off-by: David Gibson --- tcp_splice.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tcp_splice.c b/tcp_splice.c index 133e825..87fbd50 100644 --- a/tcp_splice.c +++ b/tcp_splice.c @@ -255,7 +255,6 @@ static void conn_event_do(const struct ctx *c, struct tcp_splice_conn *conn, */ void tcp_splice_conn_update(const struct ctx *c, struct tcp_splice_conn *new) { - tcp_splice_epoll_ctl(c, new); if (tcp_splice_epoll_ctl(c, new)) conn_flag(c, new, CLOSING); } -- 2.41.0