linux/fs/netfs
David Howells a0b4c7a491
netfs: Fix unbuffered/DIO writes to dispatch subrequests in strict sequence
Fix netfslib such that when it's making an unbuffered or DIO write, to make
sure that it sends each subrequest strictly sequentially, waiting till the
previous one is 'committed' before sending the next so that we don't have
pieces landing out of order and potentially leaving a hole if an error
occurs (ENOSPC for example).

This is done by copying in just those bits of issuing, collecting and
retrying subrequests that are necessary to do one subrequest at a time.
Retrying, in particular, is simpler because if the current subrequest needs
retrying, the source iterator can just be copied again and the subrequest
prepped and issued again without needing to be concerned about whether it
needs merging with the previous or next in the sequence.

Note that the issuing loop waits for a subrequest to complete right after
issuing it, but this wait could be moved elsewhere allowing preparatory
steps to be performed whilst the subrequest is in progress.  In particular,
once content encryption is available in netfslib, that could be done whilst
waiting, as could cleanup of buffers that have been completed.

Fixes: 153a9961b5 ("netfs: Implement unbuffered/DIO write support")
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/58526.1772112753@warthog.procyon.org.uk
Tested-by: Steve French <sfrench@samba.org>
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2026-02-26 14:44:32 +01:00
..
buffered_read.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
buffered_write.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
direct_read.c netfs: fix reference leak 2025-09-26 10:14:19 +02:00
direct_write.c netfs: Fix unbuffered/DIO writes to dispatch subrequests in strict sequence 2026-02-26 14:44:32 +01:00
fscache_cache.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
fscache_cookie.c netfs: Mark __nonstring lookup tables 2025-04-17 10:13:46 +02:00
fscache_internal.h netfs, fscache: Combine fscache with netfs 2023-12-24 15:08:46 +00:00
fscache_io.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
fscache_main.c fscache: delete fscache_cookie_lru_timer when fscache exits to avoid UAF 2024-09-01 10:30:25 +02:00
fscache_proc.c netfs: Fix proc/fs/fscache symlink to point to "netfs" not "../netfs" 2024-01-04 13:15:32 +00:00
fscache_stats.c netfs: Fix interaction between write-streaming and cachefiles culling 2024-01-05 15:42:25 +00:00
fscache_volume.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
internal.h netfs: Fix unbuffered/DIO writes to dispatch subrequests in strict sequence 2026-02-26 14:44:32 +01:00
iterator.c netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
Kconfig netfs: clean up after renaming FSCACHE_DEBUG config 2024-08-12 22:03:26 +02:00
locking.c netfs: Downgrade i_rwsem for a buffered write 2024-10-17 15:33:42 +02:00
main.c netfs: Renumber the NETFS_RREQ_* flags to make traces easier to read 2025-07-01 22:37:14 +02:00
Makefile netfs: Add support for caching single monolithic objects such as AFS dirs 2024-12-20 22:34:06 +01:00
misc.c vfs-6.19-rc1.folio 2025-12-01 10:26:38 -08:00
objects.c vfs-6.18-rc1.workqueue 2025-09-29 10:27:17 -07:00
read_collect.c netfs: when subreq is marked for retry, do not check if it faced an error 2026-02-08 17:07:43 -06:00
read_pgpriv2.c netfs: fix reference leak 2025-09-26 10:14:19 +02:00
read_retry.c netfs: when subreq is marked for retry, do not check if it faced an error 2026-02-08 17:07:43 -06:00
read_single.c Coccinelle-based conversion to use ->i_state accessors 2025-10-20 20:22:26 +02:00
rolling_buffer.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
stats.c netfs: Add retry stat counters 2025-02-13 16:00:48 +01:00
write_collect.c netfs: Fix unbuffered/DIO writes to dispatch subrequests in strict sequence 2026-02-26 14:44:32 +01:00
write_issue.c netfs: Fix unbuffered/DIO writes to dispatch subrequests in strict sequence 2026-02-26 14:44:32 +01:00
write_retry.c netfs: avoid double increment of retry_count in subreq 2026-02-08 17:07:43 -06:00