From patchwork Thu Oct 26 23:49:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 158705 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp244438vqb; Thu, 26 Oct 2023 16:51:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEm8FG1TgXlKd7jNOLAe6yqsM9lYDiJCgApOM1xcnGx0y2DPmXHH8SGYl4wphogTwkr25z X-Received: by 2002:a81:9995:0:b0:56c:e480:2b2b with SMTP id q143-20020a819995000000b0056ce4802b2bmr6900256ywg.12.1698364264916; Thu, 26 Oct 2023 16:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698364264; cv=none; d=google.com; s=arc-20160816; b=rHWMjLNS+k94zw1sIFknFohKnDF4Wmsf5z5o/FB97HiyM00yGp5KJOfE+SW4kXzNji TBfBgNl63dnNEFN2EwcSg1DyEeQ5yssImJ0+QaWQ0heFQzAB3fmtNUzLteq7HoyYeaa5 0deL/uIp1q9zVllwTdWNddvzuw7VrhxJ9T3bffjAanzNs+N9WOGag2azrVNhNCokP665 6fMO+I1cr7EhrFyUBlRS1jCjAzM2K340ffHl64esLdiHK+5nx3edJRQ9CcCXKzz9UANo KZvhJyjvD2xA894R+otiW3jUUFSwwEgFWg3O3Fsoz5/iDEnh2Y+/vbBGkMQ3omRJ7ih5 zrWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:from:organization :dkim-signature; bh=XraPJHpUz3iHlmRFAu43bZXLN3dhZLOzZ/zFKxawxmE=; fh=5va6T1sdGHnLNYkddLka14SmMosWXJgT2F1gLFaYJxk=; b=PgWwMNktrLg5HDaIp/8Szdkq/YX1lwSwq2bgVKheloj96Ug01x0/Bb8EhdppIHVzOw zB567CYCSaqXP9uvD0HpJJb4WF6GIgn4DS2nek48lSrAr53oInyvgBaoy0Mh5czyNo/V o7C3OL6Fo2XkPKdxcqbpGGsHYYlN1Y9acS31whTaLEjmWR3NopuboHdLpGJfwpAhoJc4 jqaQWoX2keBzPhJx9SfGbNFNDcwgDDynWAZtX2rNN3k4jiOmFpgeyRSS2MMQ/DhT6gPF 28gOSNesxQs7pHzhU9xMWELvoRsJgVD+3tnB78XNLJMr2H2H/aFzlCC95F8o0+pEjVd+ QA2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KlY7IfFC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d191-20020a0ddbc8000000b005a8157b6946si624358ywe.99.2023.10.26.16.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 16:51:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KlY7IfFC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id B437681DDE7A; Thu, 26 Oct 2023 16:51:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbjJZXuw (ORCPT + 26 others); Thu, 26 Oct 2023 19:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjJZXuv (ORCPT ); Thu, 26 Oct 2023 19:50:51 -0400 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 5858590 for ; Thu, 26 Oct 2023 16:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698364207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XraPJHpUz3iHlmRFAu43bZXLN3dhZLOzZ/zFKxawxmE=; b=KlY7IfFCcL0fAXb5V7AAM/d0dqdubAIr3NBjF93npaUW+/ZLcQ7e7N6mnKFx3XCMxJz32g TOV7gXIJTPuJcEnKenyPCwNE61gJPVdChZWlgAR/0Enf4Cl1wIYgWYC2mVoCXeUiTPEcn+ MlnMH6XuKHp92BOVsaQBxGxYwq8n4IE= 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-263-_7LOw04eNOKN3_h6Jv-UZA-1; Thu, 26 Oct 2023 19:49:36 -0400 X-MC-Unique: _7LOw04eNOKN3_h6Jv-UZA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 2F484811E7D; Thu, 26 Oct 2023 23:49:36 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id 083661121319; Thu, 26 Oct 2023 23:49:34 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: linux-afs@lists.infradead.org cc: dhowells@redhat.com, Marc Dionne , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] rxrpc: Fix two connection reaping bugs MIME-Version: 1.0 Content-ID: <783910.1698364174.1@warthog.procyon.org.uk> Date: Fri, 27 Oct 2023 00:49:34 +0100 Message-ID: <783911.1698364174@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Thu, 26 Oct 2023 16:51:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780864007248504308 X-GMAIL-MSGID: 1780864007248504308 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 --- 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); }