From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383040; b=Z9wt0jdDDh7zKr25oFSlqEP63fWIbK2bR/tIIvaN5fB8o7/MEv7u340b7Q/iMp5rwLoZ ebwS3+VcNPjX/LQKHHWlJcKpiKK7KE5maAc4ABaIesIAPfRC/MexPLwt60E8DhJ/ZPvMK BtFjLkHiFiLVK/OklXseryFoUyECj6CJcs1S82JGts6oHj7ok64nMZFZ/nHEADjb6Lrsh WJmMi4hzLh2zEpe6waD1qMOq/oEQ0QSt6n6JGTMxmBR+3F7bOM7Qg7ZZos95HxuTD6X/v GSpPlhKMA3bxHKwVsawv3qARTtzKnIU89Qs00w81roUvte+PrKMqWYrxVcD22BEOsNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383040; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=lggBFddnYymJAW2qhHiNScwolhgxes7joJbi6+Hah8E=; b=peKKYV1mmB5grWvLfEjeRlXvsiOiTNNiG5HmeqhrYUGWebd8Y4+Be3/C98Ui+PTIYZAc E/aL3J0zDvImxEZdCawRJZVuVqqrJAZ6KeMbMhIfWcFAj67d9TZLRC/knJygtZxPIVO5d xUr3yxh8N7wmfYmSkN0MFDBrula5hoRei8dCssxZex3w+vuaNdPLJ5js4iGwv2RTFXxsh ZfMECAgyJr+o+tqnwHWLmoqzFvVLuaIaysFOJKEWS64JBzMiYoe64h2Wd/KrysDdHQih5 kdhgsnQ/OU6lzafHDdJpNxqfUqGbQTSEgE43CzI7WdtrfEvxhKPSub8lCRe1xBlXvDg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NPfRYiHA; arc=none smtp.remote-ip=100.103.45.18 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 E6F1C606A333; Fri, 4 Dec 2026 11:17:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NPfRYiHA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 452AA1F00A08; Fri, 4 Dec 2026 11:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383039; bh=lggBFddnYymJAW2qhHiNScwolhgxes7joJbi6+Hah8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NPfRYiHAIpZ8Z18rLSWSAHUQfAI6a/YCfbC74tJLrgQvumUO7jbMkkjqQzECZatqi UKlNg/hO1ihf6UrRtcMe8JayeYcUTzHvY3TRLLw4YHgvCf+yY2cV7dRxqCqAz6ygaZ 00s55PNJG4CI67sLCzys8B5pD/uyzQ0xXJhvp24A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christopher Lusk , Namjae Jeon , Paulo Alcantara Subject: [PATCH 6.18 699/703] smb: client: set replay flag on the read send-error retry path Date: Fri, 4 Dec 2026 19:09:58 +0900 Message-ID: <20261204100646.441491410@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christopher Lusk commit 45f84cf25a0879a4d4e3ec3079982537be57c564 upstream. smb2_async_readv() and smb2_async_writev() end with the same send-error block: if the error is replayable and smb2_should_replay() agrees, tell netfs to retry the subrequest. The write path also sets wdata->replay. The read path does not set rdata->replay. smb2_should_replay() is not a pure predicate. It consumes the retry budget and computes the exponential back-off, doubling cur_sleep up to CIFS_MAX_SLEEP. That back-off is only applied where the replay flag is tested at the top of the reissued request: if (rdata->replay) { /* Back-off before retry */ if (rdata->cur_sleep) msleep(rdata->cur_sleep); smb2_set_replay(server, &rqst); } So on the read path the back-off is recomputed on every send-error retry and then discarded, and SMB2_FLAGS_REPLAY_OPERATION is not set on the reissued request. netfs does not pace the retry either. netfs_reissue_read() calls ->issue_read() directly, and fs/netfs/read_retry.c contains no delay of its own, so read send-error retries reissue immediately while the equivalent write retries back off. The read response callback already sets rdata->replay under the same conditions, so the read path does use the replay mechanism. Only this send-error path omits it. Where the back-off belongs was settled while the commit below was under review. David Howells asked whether netfslib should be doing the back-off [1], and objected to sleeping inside the response callback because that runs in the cifsd thread and would stall the socket [2]. The sleep was therefore taken out of smb2_should_replay() and moved to just before the replay in smb2_async_readv() and smb2_async_writev() [3]. Setting the flag here preserves that arrangement: the sleep still happens at the top of the reissued request, not in a callback. Set rdata->replay here, matching smb2_async_writev(). Fixes: 2c1238a7477a ("cifs: make retry logic in read/write path consistent with other paths") Link: https://lore.kernel.org/all/1652858.1769038134@warthog.procyon.org.uk/ [1] Link: https://lore.kernel.org/all/1653031.1769038583@warthog.procyon.org.uk/ [2] Link: https://lore.kernel.org/all/CANT5p=pXP3+CywpmK-on2uTvxO3S=31_B85_UDR7RoK1dQVtMA@mail.gmail.com/ [3] Assisted-by: Codex:gpt-5.5 Assisted-by: Claude:claude-opus-5 Signed-off-by: Christopher Lusk Signed-off-by: Namjae Jeon Signed-off-by: Paulo Alcantara Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/smb2pdu.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4893,6 +4893,7 @@ out: smb2_should_replay(tcon, &rdata->retries, &rdata->cur_sleep)) { + rdata->replay = true; trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_retry_needed); __set_bit(NETFS_SREQ_NEED_RETRY, &rdata->subreq.flags); }