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=1795606012; b=lhllHD6PxvYfJyt5o7PmZvi/RM5AJAhdipFE7xXKxqle8DmlEGai03xNEJ5Pe5JU/Kmd GDwcC6vPMWeKKgs8lLdk+2fPCUByH2PeM5Hd0e5NlLudJGU6qhw4MJUdcUPU467jDgUZG srxuvBp+MEaTsto/zg/Og2/8xHnTFdiybIof7ji/Qh0MxETwMKV37c2eQ7bEe/Vagjhah rFc228sIcvku4MTg+oRj/8otwhgP92ANO7MeYbCClsNIG66XmqFJSnNddcV9+jFFhK2iZ yG/7yQVT9TT5P17msuvRko70PRa6zZXf0hKCG/KrlsMjekkh0+xTAMPhHgQMFX65VHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795606012; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=0+FBA2/f8KWlrVSIqPMdGCjNPsRja28ktvupILnKFxY=; b=1uD0U6czWu/PeLbZL64ffCU1ksfz2ECSU96RyJaZ01TW5nFVoEQYX2z+1O0OXhFq3lM0 f9YEKjMcFvx5ybKT0Ahav/67p+SWpHhBu5saOHHrzLZcc00bWGjLHL2x55HUNLYhCj/aA L6gtjPxng8YuqMKPyXeVoj4Npa+pemhbiru+ZBTU3uRWFgvaBRfhN2UhFW8h3ZcDKZsT6 vyMoL3e13ULWOd6F839MKSrV+hErKwUxaH0KOAMd06nZ/r0cjXlxKZRs+gsS+ed2Scpns oib0BS3+SRd9/C292xcGsMndjSWWeW1R5YYUIR27yBuv4zlym+J7ToK++QAHiNuYp+w== 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=PGPqdncH; 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 9B8E7606A32E for ; Wed, 25 Nov 2026 11:26:52 +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=PGPqdncH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 903421F000D3; Wed, 25 Nov 2026 11:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795606012; bh=0+FBA2/f8KWlrVSIqPMdGCjNPsRja28ktvupILnKFxY=; h=Subject:To:Cc:From:Date; b=PGPqdncHDhxZhW/22Zkj89C0AWP3wbwwEB+7XFTkMKey7ccmb27kwv323urf9QPri FgtaWKaEwTX0dzHRFPQtmFlBnUfoJXveZMmg6jdE9DEHxnv9wzbrF+ew9TkEGX6Jws tfV9nCGGUWufZP3sjJEXYnu6g8BJSoZ2gKwLzm/M= Subject: FAILED: patch "[PATCH] smb: client: retry writeback on interrupts and allocation" failed to apply to 6.12-stable tree To: pc@manguebit.org,dhowells@redhat.com Cc: From: Date: Wed, 25 Nov 2026 12:12:32 +0100 Message-ID: <2026112532-ranking-undrafted-d85e@gregkh> 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-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x fb39fbd782bcd2dccd05f633bc6ac348209dc272 # git commit -s git send-email --to '' --in-reply-to '2026112532-ranking-undrafted-d85e@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From fb39fbd782bcd2dccd05f633bc6ac348209dc272 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Wed, 28 Oct 2026 23:09:16 -0300 Subject: [PATCH] smb: client: retry writeback on interrupts and allocation failures Issuing writes from a worker only helps when the task is already dying at issue time. A fatal signal can still arrive after that check and before __smb_send_rqst() checks again, or while waiting for a credit in cifs_call_async(), or in the middle of a send. The write then fails with -ERESTARTSYS, which isn't a replayable error, so netfs marks the subrequest failed and drops its folios clean: netfs_sreq: R=000041f6[2] UPLD SUBMT ... s=400000 0/400000 smb3_write_err: R=000041f6[2] ... offset=0x400000 len=0x400000 rc=-512 netfs_failure: R=000041f6[2] UPLD ... upload e=-512 losing 4MiB of a 64MiB file closed by a task killed meanwhile. A failed memory allocation while building or sending a write drops its data the same way. No server status maps to an interrupt error or to -ENOMEM, so for writeback such errors always mean the client gave up locally. Mark the subrequest for retry, with backoff and giving up on umount -f, as cifs did with is_retryable_error() before switching to netfslib and as NFS does for these errors. netfs collects writeback from a workqueue, so the retry gets prepared and issued with no signals pending. Only the SMB2 read and write paths sleep before replaying, so SMB1 would resend such writes right away. Move the sleep to cifs_issue_read() and __cifs_issue_write(). Fixes: 3ee1a1fc3981 ("cifs: Cut over to using netfslib") Reviewed-by: David Howells Signed-off-by: Paulo Alcantara Cc: stable@vger.kernel.org diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index bf2dc1b30e0d..5bf8f8c38542 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -212,6 +212,9 @@ static void __cifs_issue_write(struct netfs_io_subrequest *subreq) if (wdata->req->cfile->invalidHandle) goto fail; + if (wdata->replay && wdata->cur_sleep) + msleep(wdata->cur_sleep); + wdata->server->ops->async_writev(wdata); out: return; @@ -350,6 +353,9 @@ static void cifs_issue_read(struct netfs_io_subrequest *subreq) subreq->rreq->origin != NETFS_DIO_READ) __set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags); + if (rdata->replay && rdata->cur_sleep) + msleep(rdata->cur_sleep); + trace_netfs_sreq(subreq, netfs_sreq_trace_submit); rc = rdata->server->ops->async_readv(rdata); if (rc) @@ -2754,6 +2760,14 @@ void cifs_write_subrequest_terminated(struct cifs_io_subrequest *wdata, ssize_t spin_unlock(&inode->i_lock); } + if ((is_interrupt_error(result) || result == -ENOMEM) && + wreq->origin == NETFS_WRITEBACK && cifs_io_should_replay(wdata)) { + wdata->replay = true; + trace_netfs_sreq(&wdata->subreq, + netfs_sreq_trace_io_retry_needed); + __set_bit(NETFS_SREQ_NEED_RETRY, &wdata->subreq.flags); + } + netfs_write_subrequest_terminated(&wdata->subreq, result); } diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index f459b224ce74..2984af6335f4 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4910,12 +4910,8 @@ smb2_async_readv(struct cifs_io_subrequest *rdata) shdr = (struct smb2_hdr *)buf; - if (rdata->replay) { - /* Back-off before retry */ - if (rdata->cur_sleep) - msleep(rdata->cur_sleep); + if (rdata->replay) smb2_set_replay(server, &rqst); - } if (rdata->credits.value > 0) { shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(io_parms.length, @@ -5315,12 +5311,8 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) } #endif - if (wdata->replay) { - /* Back-off before retry */ - if (wdata->cur_sleep) - msleep(wdata->cur_sleep); + if (wdata->replay) smb2_set_replay(server, &rqst); - } cifs_dbg(FYI, "async write at %llu %u bytes iter=%zx\n", io_parms->offset, io_parms->length, iov_iter_count(&wdata->subreq.io_iter));