linux/fs/netfs
David Howells 1ca4169c39
netfs: Fix missing wakeup after issuing writes
After dividing up a proposed write into subrequests, netfslib sets
NETFS_RREQ_ALL_QUEUED to indicate to the collector that it can move on to
the final cleanup once it has emptied the subrequest queues.

Now, whilst the collector will normally end up running at least once after
this bit is set just because it takes a while to process all the write
subrequests before the collector runs out of subrequests, there exists the
possibility that the issuing thread will be forced to sleep and the
collector thread will clean up all the subrequests before ALL_QUEUED gets
set.

In such a case, the collector thread will not get triggered again and will
never clear NETFS_RREQ_IN_PROGRESS thus leaving a request uncompleted and
causing a potential futute hang.

Fix this by scheduling the write collector if all the subrequest queues are
empty (and thus no writes pending issuance).

Note that we'd do this ideally before queuing the subrequest, but in the
case of buffered writeback, at least, we can't find out that we've run out
of folios until after we've called writeback_iter() and it has returned
NULL - at which point we might not actually have any subrequests still
under construction.

Fixes: 288ace2f57 ("netfs: New writeback implementation")
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/3317784.1727880350@warthog.procyon.org.uk
cc: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-02 16:56:15 +02:00
..
buffered_read.c netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
buffered_write.c netfs, cifs: Fix mtime/ctime update for mmapped writes 2024-09-24 21:57:00 -05:00
direct_read.c netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
direct_write.c netfs: Revert "netfs: Switch debug logging to pr_debug()" 2024-07-24 10:15:37 +02:00
fscache_cache.c netfs: Revert "netfs: Switch debug logging to pr_debug()" 2024-07-24 10:15:37 +02:00
fscache_cookie.c fs/netfs/fscache_cookie: add missing "n_accesses" check 2024-08-12 22:03:26 +02:00
fscache_internal.h netfs, fscache: Combine fscache with netfs 2023-12-24 15:08:46 +00:00
fscache_io.c netfs: Revert "netfs: Switch debug logging to pr_debug()" 2024-07-24 10:15:37 +02: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 netfs: Revert "netfs: Switch debug logging to pr_debug()" 2024-07-24 10:15:37 +02:00
internal.h netfs: Fix write oops in generic/346 (9p) and generic/074 (cifs) 2024-09-26 17:45:20 -05: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 inode: remove __I_DIO_WAKEUP 2024-08-30 08:22:37 +02:00
main.c vfs-6.12.netfs 2024-09-16 12:13:31 +02:00
Makefile netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
misc.c netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer 2024-10-01 16:02:42 +02:00
objects.c netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
read_collect.c netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
read_pgpriv2.c cachefiles, netfs: Fix write to partial block at EOF 2024-09-12 12:20:41 +02:00
read_retry.c netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
stats.c netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
write_collect.c netfs: Speed up buffered reading 2024-09-12 12:20:41 +02:00
write_issue.c netfs: Fix missing wakeup after issuing writes 2024-10-02 16:56:15 +02:00