🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17434

Re: [PATCH v2 1/3] SUNRPC: freeze rpciod and xprtiod across system sleep

#17434
From: "Anna Schumaker"
Date: Mon, 16 Nov 2026 19:32
127 lines
15971 bytes
Hi Andrew,

On Mon, Nov 16, 2026, at 8:14 AM, Andrew Pam wrote:
> After hibernation takes its snapshot, the kernel thaws devices to write
> the image, and the NIC with them. Freezable kernel threads and
> workqueues stay frozen until the image is restored, but rpciod and
> xprtiod are not freezable, so RPCs continue to be transmitted, and
> transports reconnected, until power-off. The server acts on them; the
> restored image knows nothing of them.
>
> With NFSv4.1 this wedges the mount after resume. Captured between a
> client that hibernated and its server (Linux 7.0 client, 6.12 server):
>
>   - 05:06:02 last exchange before the snapshot; client snd_nxt
>     2711544997.
>   - 05:06:15 hibernation entry.
>   - 05:06:44 and 05:07:48, after the snapshot: a lease-renewal
>     SEQUENCE on slot 0 (seqid 192219), the next (192220), and
>     DELEGRETURNs on slots 1-5. The server executes all of them and
>     acknowledges up to TCP sequence 2711546645.
>   - 14 hours later, on resume: the client retransmits the slot 0
>     SEQUENCE from TCP sequence 2711544997. The server discards it as a
>     duplicate and acknowledges 2711546645, which the client ignores as
>     acknowledging unsent data. Nothing more crosses the connection.
>   - On reconnecting, slot 0 gets NFS4ERR_SEQ_MISORDERED (server at
>     192220, client at 192219) every 15 seconds indefinitely; the state
>     manager waits in nfs4_begin_drain_session() for that task, and
>     every other RPC waits behind it.
>
> Other resumes produced the same rollback with different symptoms:
> requests accepted by the server's TCP but never reaching nfsd, or a
> partial overlap that left nfsd reading a session ID as a record marker
> ("svc_tcp_read_marker nfsd RPC fragment too large"). Restarting the
> server is the only recovery.
>
> Make both workqueues freezable, as the SMB client already does for all
> of its workqueues (WQ_FREEZABLE | WQ_MEM_RECLAIM). Work queued while
> frozen runs after thaw_processes(), in the restored kernel, which is
> consistent with the server. Memory preallocation for the image happens
> before freeze_kernel_threads(), so writeback through rpciod is still
> available then, and pm_restrict_gfp_mask() keeps reclaim from issuing
> I/O while the image is written.
>
> WQ_FREEZABLE is consulted only when freezing and thawing, not when work
> is queued or run, so normal operation is unaffected. Entering system
> sleep now waits for in-flight rpciod and xprtiod items to finish; these
> are short state-machine steps with non-blocking sends and connects. If
> one ever blocked for longer than freeze_timeout_msecs, suspend or
> hibernation would fail, naming the busy workqueue, where today it
> proceeds. The SMB client and XFS accept the same trade-off for their
> reclaim workqueues.
>
> This does not stop the network stack from acknowledging data the
> server sends after the snapshot, such as a callback or a reply to a
> request still in flight when the snapshot was taken; that remains
> a general hibernation and TCP problem.
>
> No Fixes: tag: rpciod has never been freezable, so no single commit
> introduced this.

Can you take a human editing-pass over this commit message, please? Try
to really focus it on what this patch does and why it is important. The
"No Fixes: tag:" part really sticks out to me as an unnecessary addition,
and the testing stuff (below) should be in the cover letter and not the
patch itself.

>
> Tested in QEMU/KVM: an NFSv4.2 client hibernating in test_resume mode
> (the image is written, then restored at once) against a 7.4-rc2 nfsd
> with a 10 second lease, with 1.2 GB of incompressible data in memory and
> the swap device throttled so that writing the image takes 81 seconds.
> Without this patch the server received 12 SEQUENCE renewals during the
> image write, none of which the restored client knew of; after the
> restore the client's mountstats show a SEQUENCE error, two extra
> connections and 10 seconds of queueing before it recovered. With this
> series the server received nothing from the snapshot until the restore,
> and the client resumed without errors. The indefinite hang seen on real
> hardware was not reproduced in the VM: it also needs a request holding
> a session slot across the restore.
>
> Drafted with an AI coding assistant (Claude), which analysed the packet
> capture, wrote the change and this description, and ran the test above.
>
> Signed-off-by: Andrew Pam <andrew@sericyb.com.au>
> ---
>  net/sunrpc/sched.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
> index 016f16ca5779..41f25309b8fb 100644
> --- a/net/sunrpc/sched.c
> +++ b/net/sunrpc/sched.c
> @@ -1276,13 +1276,18 @@ static int rpciod_start(void)
>  	struct workqueue_struct *wq;
> 
>  	/*
> -	 * Create the rpciod thread and wait for it to start.
> +	 * Both workqueues are freezable so that no RPC is transmitted, and
> +	 * no connection is made, between taking a hibernation snapshot and
> +	 * powering off. Anything sent then changes the server's state but is
> +	 * missing from the image, and is forgotten when the image is restored.

Let's leave the original comment alone, please.

>  	 */
> -	wq = alloc_workqueue("rpciod", WQ_MEM_RECLAIM | WQ_UNBOUND, 0);
> +	wq = alloc_workqueue("rpciod",
> +			     WQ_MEM_RECLAIM | WQ_UNBOUND | WQ_FREEZABLE, 0);

Note that this change is going to conflict with Chuck's "NFS: Set WQ_SYSFS on nfsiod"
patch that I'm expecting to go into v7.5:  https://lore.kernel.org/linux-nfs/20260915-performance-v3-3-ae26d460bfd3@kernel.org/

Thanks,
Anna

>  	if (!wq)
>  		goto out_failed;
>  	rpciod_workqueue = wq;
> -	wq = alloc_workqueue("xprtiod", WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
> +	wq = alloc_workqueue("xprtiod",
> +			     WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_FREEZABLE, 0);
>  	if (!wq)
>  		goto free_rpciod;
>  	xprtiod_workqueue = wq;
> -- 
> 2.53.0
Technical Details
Message-ID: <0d9f6196-6737-4936-a8fd-97192d96ad3f@app.fastmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364678-linux-kernel-netdev=dewy.ru
References: <20261116131428.1024230-1-andrew@sericyb.com.au> <20261116131428.1024230-2-andrew@sericyb.com.au>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364678-linux-kernel-netdev=dewy.ru
From: anna@kernel.org ("Anna Schumaker")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 1/3] SUNRPC: freeze rpciod and xprtiod across system sleep
Date: Mon, 16 Nov 2026 14:32:00 -0500
Organization: Usenet Network
Message-ID: <0d9f6196-6737-4936-a8fd-97192d96ad3f@app.fastmail.com>
References: <20261116131428.1024230-1-andrew@sericyb.com.au>
 <20261116131428.1024230-2-andrew@sericyb.com.au>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2150813"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:SZDGz81gmunSLGvl/RKxhMhCx1A= sha256:CqIZ5H+VdLQ00zh9Q2M654xa4/jZ8n1me5WZL0DaYXc=
	sha1:ZtBWc7QuTdaH/b+oOsXFyBTbUJ4= sha256:kh2PKD1fnH5A4WPzgNwRW5L2qthI5GlMW0UUhzNjg78=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 13CFE114D5C; Mon, 16 Nov 2026 22:32:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id S_1JvQ2h7UE6;
	Mon, 16 Nov 2026 22:32:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364678-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0F916114D2C; Mon, 16 Nov 2026 22:32:33 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 441F12A0A7; Mon, 16 Nov 2026 19:32:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794857548;
	b=tp5lLQfYEQCQt1rFa1LN3zpLs4jA8Em+oCtgdwhSp5Px4g+bt821M35oaI4LX6xWQYyi
	 CC1tAbTXYB99+tVSE1Xg8OiICUwoSYR3EhKA0E0t32RzJC/Ji7nJPXbVWiwtOfSSMmBa8
	 OTkl6E31ygXkzXsM1nIWDY1lChZ8COpDALYk6uka+/zyki86gAjmcO1ErBfiYD420b3iq
	 LbLkZbmN0WYaluc1uh7FXWPlRMm4ITuS/vSvu1tF0c2wiW3k9J/UvXy5IRdDqX9e2X/Am
	 K5xulqYTl/R9CACfVKxsB8ZBsD1stwIbHchqfADsNmX1HWPpUn/3i6/iExCwpr3221w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794857548;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:Received:
	 X-ME-Sender:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:X-Mailer:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:X-ThreadId:Date:
	 From:To:Cc:Message-Id:In-Reply-To:References:Subject:Content-Type:
	 Content-Transfer-Encoding;
	bh=ZEIMr6EF+k/i2QSfrEbyqXIr/Dpz+3YkZ2g23ZXT9A4=;
	b=BrkZ2wSQWyHUcb2xj4GO9gOT4bg/tdPaSU6SgMpQz0mgnHC2Bv6/KohuPoDEvJnkOLAS
	 bUq06C87j2xcGY6l2VuC5pkXdiSNmxVR/T4cx/6hPn9OFdLwYOi3guEvEvD07s0jmBmNV
	 npaVFAluYWj0A8A3yPQFXF8QrJdOO/4ShoEwoxKPiCtZqtxYc38Kto2efZTHA/gXcyj57
	 AXiPaCgYhdkmKETv6UUaDMRjfLFhNHjZFDyPwrCyAqAWiOraMGFS7QZnQivcWSMBsLziK
	 3ceqz8KOUe4AJ8PQh0QSIVUiee3KEp5JdKzGcCfgG7NSwQM9YTEN6bLZCLUEcLcojgg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O4nuskAk;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 1622E606A330;
	Mon, 16 Nov 2026 19:32:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O4nuskAk
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794857542;
	b=SgHQ22Uw/vOexyIqrlg8PRE7LY8yhcH305O3GEpSxjYnHFo0yc2mOHdtFnLTFxwE20Bi
	 3Y71g6gEEIGzcrVvdEhfmZggAtSyrBhJn1n4FaEjEmSzhf1aIygOhL8i3UOHbGCif7Qex
	 Nn+nlsNAKazAhgcQ2TWSMfFVX6B/Z76uQuZgpVlahYDUWptv4fWDmgex5wjKxBoUtDezV
	 wnyEXbGHK9ovDfXDXvNyatsw/YTUpDZF4gB6Lxig+/MqDuS/qydJAueuYKdsGBvbBk9C/
	 KNNx5bBamO1E064zKnCct2JmFnCiN9z65lolqE0KNNHHoyVjWkWWc9Ejvg4vm9wAp2A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794857542;
	h=Received:DKIM-Signature:Received:Received:X-ME-Sender:
	 X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:X-Mailer:
	 MIME-Version:X-ThreadId:Date:From:To:Cc:Message-Id:In-Reply-To:
	 References:Subject:Content-Type:Content-Transfer-Encoding;
	bh=ZEIMr6EF+k/i2QSfrEbyqXIr/Dpz+3YkZ2g23ZXT9A4=;
	b=SYvjB2CibpSHHuTN3k5+Rj0QyFFERYDrTZsfVXDRlPehxnBC8X1F3lwCULOSZuN+TvN8
	 uBGhHg6s5Equ5JdtcZtIGtr8FYol1dBT2XgoJGnn6ecAFXwRFHQCM2PrWYXojL6oFqPO0
	 YfVOBe0zLVfCJqEXZvRv9RwqTq+XnC5vTCDnCTn/QGG30/dtD/JPD/n5MqftDDooG8F7l
	 RAYDN4IaGNtG0+Zlj2hluKqp3WhaZltZl51Q6K64GQC8f7QyGsQX+vKFghC1fAtQMjUlY
	 WSEg21h+++pETlcFEVxR992qRkqopmHFg/Mpex4vRZWztXYCTafIPZz7X4iDdGHkffg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O4nuskAk;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31511606A32C;
	Mon, 16 Nov 2026 19:32:21 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3094D1F000C5;
	Mon, 16 Nov 2026 19:32:21 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794857541;
	bh=ZEIMr6EF+k/i2QSfrEbyqXIr/Dpz+3YkZ2g23ZXT9A4=;
	h=Date:From:To:Cc:In-Reply-To:References:Subject;
	b=O4nuskAkLzdyNkorLNE6nrBNrhOdCp8yYSHgsGVbTiwSi/0fcQFeUdDjJ8nV7ZkDq
	 3HNoqHatloVGJXBPLGS8mHAfsRa6S5opxuymF/CJwH4h06J5kz7EOC9ZAsyKwNwZmT
	 26Q69Ytb2B+xhzkQ0+TXnG/hXUW1BWWhslkakhwBPOgILkVBfSe2X0WVoAEn2r2y3q
	 xluUgKvZh+MacnD6q7jc4zQRcosHEHLl1u5HwlwhMdmKgCrQ0fWtCpGQl5lS5SQxIl
	 zdHDOFMQQ8YBv6iWhJli5VvRCG7SGnk1HmpFkQNWVRgpH3ehXjiSByDZH2xqRdDQbq
	 4xDQxA7LIPTNA==
X-Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42])
	by mailfauth.phl.internal (Postfix) with ESMTP id 6CB92F40090;
	Mon, 16 Nov 2026 14:32:20 -0500 (EST)
X-Received: from phl-imap-04 ([10.202.2.82])
  by phl-compute-02.internal (MEProxy); Mon, 16 Nov 2026 14:32:20 -0500
X-ME-Sender: <xms:RFr7aktLigboh5T4EUH2EElUd9DIlxZdqjNhmxh5QNQCMZAZ7-vtwg>
    <xme:RFr7asREOlfIHidzh-t-ZZiWBcrGT9dDrffCN1bLlKNfo86FhvGFFz3M3YNEsWB-V
    osuO7Bl-z92PAacBmWA3rgtDeDTTusERy29-5T-BsJ7J3kmw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964851:Fastmail
X-Received: by mailuser.phl.internal (Postfix, from userid 501)
	id 5115DB6006E; Mon, 16 Nov 2026 14:32:20 -0500 (EST)
X-Mailer: MessagingEngine.com Webmail Interface
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-ThreadId: AB_Ze6YMkrK7
X-Cc: "Chuck Lever" <cel@kernel.org>, "Jeff Layton" <jlayton@kernel.org>,
 NeilBrown <neil@brown.name>, "Olga Kornievskaia" <okorniev@redhat.com>,
 "Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
 "Rafael J. Wysocki" <rafael@kernel.org>, "Mike Snitzer" <snitzer@kernel.org>,
 linux-nfs@vger.kernel.org, linux-pm@vger.kernel.org, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261116131428.1024230-2-andrew@sericyb.com.au>