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 5A8575A026F for ; Thu, 12 Oct 2023 03:51:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1697075480; bh=3W8GXQQSdiguxWc5naYpM/iGOCWFb9oHelOvPgHPdzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cnGrBrb+CaqAggoHFSJ4NpuheT2HNQDu5uV4Gp/eP/XmHvE7acjqlQXvKpB6q14St mG75lsfxVLOLUSjMEU5lUEBorTXCT5+Y1Q8f+tWd0QD+kAfNv88if5F+Nir9PD1+5y IbMi0dy2P1RvIVEMH41QKGtmld/23LAQK/zAh5OQ= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4S5Xfw0Hw1z4x80; Thu, 12 Oct 2023 12:51:20 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 01/11] tcp_splice: Remove redundant tcp_splice_epoll_ctl() Date: Thu, 12 Oct 2023 12:51:04 +1100 Message-ID: <20231012015114.2612066-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012015114.2612066-1-david@gibson.dropbear.id.au> References: <20231012015114.2612066-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 47GGCDB3XU5HKPLC6NKGCCS7KIOPBF6L X-Message-ID-Hash: 47GGCDB3XU5HKPLC6NKGCCS7KIOPBF6L 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 19f5406..fd6ce8d 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