[PATCH netfs v1 0/2] preserve prepare_write errno across write reissue
From: Iván Ezequiel Rodriguez
Date: Wed Oct 28 2026 - 14:27:00 EST
cifs (and others) may fail in prepare_write() with
netfs_prepare_write_failed() before write_retry calls
netfs_reissue_write(). Since 82e8885bd763, reissue clears
subreq->error to 0 for a clean I/O retry, so a FAILED subreq is
terminated with 0. The collector then does mapping_set_error(0),
which is a no-op — writeback errno is lost (not an infinite retry).
Patch 1 skips that clear when FAILED is already set.
Patch 2 adds a KUnit stub test: FAIL unpatched, PASS patched.
./tools/testing/kunit/kunit.py run --kunitconfig=fs/netfs/.kunitconfig \
netfs_reissue_write*
No prior lore report found for this interaction; surfaces on top of
Shyam's NEED_RETRY change.
Cc: David Howells <dhowells@xxxxxxxxxx>
Cc: Paulo Alcantara <pc@xxxxxxxxxxxxx>
Cc: Shyam Prasad N <sprasad@xxxxxxxxxxxxx>
Cc: Steve French <stfrench@xxxxxxxxxxxxx>
Cc: netfs@xxxxxxxxxxxxxxx
Cc: linux-fsdevel@xxxxxxxxxxxxxxx
Cc: linux-cifs@xxxxxxxxxxxxxxx
Iván Ezequiel Rodriguez (2):
netfs: preserve prepare_write errno on reissue
netfs: add KUnit coverage for reissue prepare_write errno
fs/netfs/.kunitconfig | 3 ++
fs/netfs/Kconfig | 9 +++++
fs/netfs/Makefile | 2 +
fs/netfs/write_collect.c | 4 ++
fs/netfs/write_issue.c | 4 +-
fs/netfs/write_reissue_kunit.c | 73 ++++++++++++++++++++++++++++++++++
6 files changed, 94 insertions(+), 1 deletion(-)
create mode 100644 fs/netfs/.kunitconfig
create mode 100644 fs/netfs/write_reissue_kunit.c
--
2.43.0