From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11A563264DD for ; Wed, 24 Jun 2026 16:38:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782319140; cv=none; b=SCO4CKofdC7sWbt+5IvxbmSVwAgMdaB/L2s2uEmcm+lyb4jBXRL95X3VT/jvSiQg79aI5Co+dZXjLy87MZhZr8IdKFOjzwLtuNTj00yjxml/WPlWB9tQBMETtGPTtnPOAWLqMJdawJrD/U6XzhUzf+ly2z0mfBY1K3+ntYa9xQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782319140; c=relaxed/simple; bh=Va+yKy2/FkolCMd/GCJ04uXTiRE4JfESuAvMxTBfmb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OxkvSh4eyY+LIZQDK4afbznS0MNC/mZBihnIUdVUT1wnaEO9DUlWKJo9CFjuVOdOkQGPd1gyla4594EhbO2E4q0TAb16mJOVCkTGUmlnMdAHbK09lMUMlGEfdRC8y3kRaEaG3T2K67tIsSSAZm8S+thu3laFQTNai0Bc/4hUiN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ItJo1N8f; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ItJo1N8f" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782319138; 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=v5uBywD1IR8bWSBUhdftpbDFcQtmhATeSufUz/oD8vA=; b=ItJo1N8fdpoCpEEK0tlaCH0CyKx7Q+bZ6cJ9HVcTINqoKR9y5m9I3GE6UTfsox6nwLlvJa kLcMhEnwcGvbmPqeeCF38B1YASygpDuHf0naDjZ+HJpeyVbT0j0YJgRLpmMArMrF2BnTxB Meata/Ds46CazFQ7neY8k0bYjfUAmX4= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-NltzDBGzOXiAPKT-lgdT7A-1; Wed, 24 Jun 2026 12:38:52 -0400 X-MC-Unique: NltzDBGzOXiAPKT-lgdT7A-1 X-Mimecast-MFC-AGG-ID: NltzDBGzOXiAPKT-lgdT7A_1782319130 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 395B71801BDA; Wed, 24 Jun 2026 16:38:50 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.44.49.152]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D812030003B6; Wed, 24 Jun 2026 16:38:45 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, Li Daming , Ren Wei , Jeffrey Altman , stable@kernel.org Subject: [PATCH net v3 04/11] afs: Fix further netns teardown to cancel the preallocation charger Date: Wed, 24 Jun 2026 17:38:11 +0100 Message-ID: <20260624163819.3017002-5-dhowells@redhat.com> In-Reply-To: <20260624163819.3017002-1-dhowells@redhat.com> References: <20260624163819.3017002-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 When an afs network namespace is torn down, it cancels and waits for the work item that keeps the preallocated rxrpc call/conn/peer queue charged before disabling incoming (i.e. listen 0), but there's a small window in which it can be requeued by an incoming call wending through the I/O thread. Fix this by cancelling the charger work item again after reducing the listen backlog to zero. Fixes: 47694fbc9d24 ("afs: Fix netns teardown to cancel the preallocation charger") Reported-by: Jakub Kicinski Signed-off-by: David Howells Link: https://sashiko.dev/#/patchset/20260609140911.838677-1-dhowells%40redhat.com cc: Li Daming cc: Ren Wei cc: Marc Dionne cc: Jeffrey Altman cc: Eric Dumazet cc: "David S. Miller" cc: Paolo Abeni cc: Simon Horman cc: linux-afs@lists.infradead.org cc: stable@kernel.org --- fs/afs/rxrpc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index d5cfd24e815b..6714a189d58f 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c @@ -128,8 +128,13 @@ void afs_close_socket(struct afs_net *net) _enter(""); cancel_work_sync(&net->charge_preallocation_work); + /* Future work items should now see ->live is false. */ + kernel_listen(net->socket, 0); + + /* Make sure work items are no longer running. */ flush_workqueue(afs_async_calls); + cancel_work_sync(&net->charge_preallocation_work); if (net->spare_incoming_call) { afs_put_call(net->spare_incoming_call);