From: "Iván Ezequiel Rodriguez" <ivanrwcm25@gmail.com>
To: David Howells <dhowells@redhat.com>,
Paulo Alcantara <pc@manguebit.org>,
netfs@lists.linux.dev
Cc: Shyam Prasad N <sprasad@microsoft.com>,
Steve French <stfrench@microsoft.com>,
linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH netfs v1 1/2] netfs: preserve prepare_write errno on reissue
Date: Wed, 28 Oct 2026 15:12:28 -0300 [thread overview]
Message-ID: <20261028181229.1408342-2-ivanrwcm25@gmail.com> (raw)
In-Reply-To: <20261028181229.1408342-1-ivanrwcm25@gmail.com>
prepare_write() may call netfs_prepare_write_failed() (FAILED + errno)
before write_retry calls netfs_reissue_write(). Clearing subreq->error
to 0 for a clean I/O reissue (82e8885bd763) then makes
netfs_do_issue_write() terminate with 0. The collector copies
front->error into stream->error and mapping_set_error(), which ignores
0, so writeback failure is silent.
Skip clearing error when NETFS_SREQ_FAILED is already set;
do_issue_write() already terminates FAILED subrequests.
Fixes: 82e8885bd763 ("netfs: when subreq is marked for retry, do not check if it faced an error")
Cc: Shyam Prasad N <sprasad@microsoft.com>
Cc: Steve French <stfrench@microsoft.com>
Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
---
fs/netfs/write_issue.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c
index b8237e1314d8..f23364116421 100644
--- a/fs/netfs/write_issue.c
+++ b/fs/netfs/write_issue.c
@@ -268,7 +268,9 @@ void netfs_reissue_write(struct netfs_io_stream *stream,
iov_iter_truncate(&subreq->io_iter, size);
subreq->retry_count++;
- subreq->error = 0;
+ /* Keep prepare_write() errno; do_issue_write() terminates FAILED. */
+ if (!test_bit(NETFS_SREQ_FAILED, &subreq->flags))
+ subreq->error = 0;
__clear_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);
__set_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags);
netfs_stat(&netfs_n_wh_retry_write_subreq);
--
2.43.0
next prev parent reply other threads:[~2026-10-28 18:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 18:12 [PATCH netfs v1 0/2] preserve prepare_write errno across write reissue Iván Ezequiel Rodriguez
2026-10-28 18:12 ` Iván Ezequiel Rodriguez [this message]
2026-10-28 18:12 ` [PATCH netfs v1 2/2] netfs: add KUnit coverage for reissue prepare_write errno Iván Ezequiel Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028181229.1408342-2-ivanrwcm25@gmail.com \
--to=ivanrwcm25@gmail.com \
--cc=dhowells@redhat.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netfs@lists.linux.dev \
--cc=pc@manguebit.org \
--cc=sprasad@microsoft.com \
--cc=stfrench@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox