From patchwork Thu Nov 9 15:39:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 163419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp521384vqs; Thu, 9 Nov 2023 07:42:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4geM/A926C5do7mRhJ6YjMooePJkeH0v4LI7V9nQxSsenZ5DxD/8Jz21G/rEupaq1O04p X-Received: by 2002:a05:6830:7191:b0:6d3:2d62:a93d with SMTP id el17-20020a056830719100b006d32d62a93dmr6705452otb.29.1699544562976; Thu, 09 Nov 2023 07:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699544562; cv=none; d=google.com; s=arc-20160816; b=MJ15PeFlmzGHxz82ECIb8pzkzde60i+Opqp3+Gk8GM8bvRFLF/b5wCOKFnf8W2Bggs SVMZrKzk2UZ8l+kZtq7Y169nkftk+cDaDjytjzSU0LJbpIyNS3PuvdLwZsyacztxkDsO BjBXRq3Cs/9833tkX1b9SB3gGDV649tPS4Tn+Wz4WgID3qzWuUfKe6wZNgX5qVsSvECi 049ZPPxZZqZta7R5FZTlVKVZWxccXrE4QI8ctEJMyUrXzGNEs5aL6thAhqT7oAzYLKRu EB1KWLBR/7hOmzwLEKAWhrJP2LAmMlxo3vDmbaF7BopylBVBBWv6fum0f3+0DntYpm6F gejQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LyBoCbElMBWTxv8fACt2i5x96KxhIHRnkO6so+DaPzc=; fh=voc3GHI2d5HkOAn80rHELKYDjKoUjN1McBGfRgqrTMU=; b=fDuhRQhBfoWJ2nX1jme71t2Zmlg6kG3IiHK56qISZzm2duD0H11U+pnNrRCAtpzlNm WeJ2AsCKPPgu5PTxyLN/26Q94IMy4Z3U90PmkDjhRIo06lCNB8sd2VHJXNzjZH2JSyyd Lh8CfI+RyrFwsqwFQ0BrgQ+RFX+rE5Z5JFvPCSuFOPFoMnA88F8Oe1coPjdZoEI84OlY 2Q3UVWZCLR8rOWoYjjsKEpqbc8qFWiZx3ts8JNMzL17iZmkbe+iEidaBy1YDpi/GI38l u8hM1jMVbPV0MVRbL6GHIsP3frTwE/9rwbdLo+yjjeI5NpsIazOb9JI9WSgCB+37g2ef pENA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AxbGeHrD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t23-20020a656097000000b005bce484bff8si7225761pgu.647.2023.11.09.07.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 07:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AxbGeHrD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5AC42809E733; Thu, 9 Nov 2023 07:41:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343586AbjKIPlH (ORCPT + 31 others); Thu, 9 Nov 2023 10:41:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234513AbjKIPlC (ORCPT ); Thu, 9 Nov 2023 10:41:02 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43A1935AA for ; Thu, 9 Nov 2023 07:40:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699544417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LyBoCbElMBWTxv8fACt2i5x96KxhIHRnkO6so+DaPzc=; b=AxbGeHrDyFhwxqLXlJqGJjPvwkX0dNy0bRU+K0E6dJKeMs3u3VpaER0VKI+Dwk1liJRu1R qjeFOjqdl8CgBPWDj8A/xYLFE2pfwEuzuf1vVS6tXvuO5TFC5/t5NFKbUTDgZFzn8bMBtz uZf3PKVPRxZnSg26/cklRxwhEac2kwU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-XzmQuWuwO7OKmcbrwpdI4Q-1; Thu, 09 Nov 2023 10:40:14 -0500 X-MC-Unique: XzmQuWuwO7OKmcbrwpdI4Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B26E8185A782; Thu, 9 Nov 2023 15:40:13 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 605AB492BE7; Thu, 9 Nov 2023 15:40:12 +0000 (UTC) From: David Howells To: Marc Dionne Cc: David Howells , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH 02/41] rxrpc: Fix two connection reaping bugs Date: Thu, 9 Nov 2023 15:39:25 +0000 Message-ID: <20231109154004.3317227-3-dhowells@redhat.com> In-Reply-To: <20231109154004.3317227-1-dhowells@redhat.com> References: <20231109154004.3317227-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 07:41:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782101639656380953 X-GMAIL-MSGID: 1782101639656380953 Fix two connection reaping bugs: (1) rxrpc_connection_expiry is in units of seconds, so rxrpc_disconnect_call() needs to multiply it by HZ when adding it to jiffies. (2) rxrpc_client_conn_reap_timeout() should set RXRPC_CLIENT_REAP_TIMER if local->kill_all_client_conns is clear, not if it is set (in which case we don't need the timer). Without this, old client connections don't get cleaned up until the local endpoint is cleaned up. Fixes: 5040011d073d ("rxrpc: Make the local endpoint hold a ref on a connected call") Fixes: 0d6bf319bc5a ("rxrpc: Move the client conn cache management to the I/O thread") Signed-off-by: David Howells cc: Marc Dionne cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: netdev@vger.kernel.org cc: linux-afs@lists.infradead.org Reviewed-by: Jeffrey Altman --- net/rxrpc/conn_object.c | 2 +- net/rxrpc/local_object.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c index ac85d4644a3c..df8a271948a1 100644 --- a/net/rxrpc/conn_object.c +++ b/net/rxrpc/conn_object.c @@ -212,7 +212,7 @@ void rxrpc_disconnect_call(struct rxrpc_call *call) conn->idle_timestamp = jiffies; if (atomic_dec_and_test(&conn->active)) rxrpc_set_service_reap_timer(conn->rxnet, - jiffies + rxrpc_connection_expiry); + jiffies + rxrpc_connection_expiry * HZ); } rxrpc_put_call(call, rxrpc_call_put_io_thread); diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 7d910aee4f8c..c553a30e9c83 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c @@ -87,7 +87,7 @@ static void rxrpc_client_conn_reap_timeout(struct timer_list *timer) struct rxrpc_local *local = container_of(timer, struct rxrpc_local, client_conn_reap_timer); - if (local->kill_all_client_conns && + if (!local->kill_all_client_conns && test_and_set_bit(RXRPC_CLIENT_CONN_REAP_TIMER, &local->client_conn_flags)) rxrpc_wake_up_io_thread(local); }