From: Christian Brauner Date: Wed, 21 May 2025 12:35:34 +0000 (+0200) Subject: Merge patch series "netfs: Miscellaneous fixes" X-Git-Tag: v6.16-rc1~76^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5fddfbc0cbc55a6b506f8cd07c58a152a3b535d6;p=thirdparty%2Fkernel%2Flinux.git Merge patch series "netfs: Miscellaneous fixes" David Howells says: Here are some miscellaneous fixes and changes for netfslib, if you could pull them: (1) Fix an oops in write-retry due to mis-resetting the I/O iterator. (2) Fix the recording of transferred bytes for short DIO reads. (3) Fix a request's work item to not require a reference, thereby avoiding the need to get rid of it in BH/IRQ context. (4) Fix waiting and waking to be consistent about the waitqueue used. * patches from https://lore.kernel.org/20250519090707.2848510-1-dhowells@redhat.com: netfs: Fix wait/wake to be consistent about the waitqueue used netfs: Fix the request's work item to not require a ref netfs: Fix setting of transferred bytes with short DIO reads netfs: Fix oops in write-retry from mis-resetting the subreq iterator Link: https://lore.kernel.org/20250519090707.2848510-1-dhowells@redhat.com Signed-off-by: Christian Brauner --- 5fddfbc0cbc55a6b506f8cd07c58a152a3b535d6 diff --cc fs/netfs/buffered_read.c index 5f53634a38625,fd4619275801b..18b3dc74c70e4 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@@ -364,14 -362,13 +364,12 @@@ void netfs_readahead(struct readahead_c rreq->submitted = rreq->start; if (rolling_buffer_init(&rreq->buffer, rreq->debug_id, ITER_DEST) < 0) goto cleanup_free; - netfs_read_to_pagecache(rreq); + netfs_read_to_pagecache(rreq, ractl); - netfs_put_request(rreq, true, netfs_rreq_trace_put_return); - return; + return netfs_put_request(rreq, netfs_rreq_trace_put_return); cleanup_free: - netfs_put_request(rreq, false, netfs_rreq_trace_put_failed); - return; + return netfs_put_request(rreq, netfs_rreq_trace_put_failed); } EXPORT_SYMBOL(netfs_readahead); @@@ -528,9 -526,9 +526,9 @@@ int netfs_read_folio(struct file *file if (ret < 0) goto discard; - netfs_read_to_pagecache(rreq); + netfs_read_to_pagecache(rreq, NULL); ret = netfs_wait_for_read(rreq); - netfs_put_request(rreq, false, netfs_rreq_trace_put_return); + netfs_put_request(rreq, netfs_rreq_trace_put_return); return ret < 0 ? ret : 0; discard: @@@ -750,9 -748,9 +748,9 @@@ int netfs_prefetch_for_write(struct fil if (ret < 0) goto error_put; - netfs_read_to_pagecache(rreq); + netfs_read_to_pagecache(rreq, NULL); ret = netfs_wait_for_read(rreq); - netfs_put_request(rreq, false, netfs_rreq_trace_put_return); + netfs_put_request(rreq, netfs_rreq_trace_put_return); return ret < 0 ? ret : 0; error_put: diff --cc fs/netfs/direct_read.c index f11a89f2fdd9a,a24e63d2c8186..e72c8b69b1475 --- a/fs/netfs/direct_read.c +++ b/fs/netfs/direct_read.c @@@ -103,9 -103,12 +103,9 @@@ static int netfs_dispatch_unbuffered_re rreq->netfs_ops->issue_read(subreq); if (test_bit(NETFS_RREQ_PAUSE, &rreq->flags)) - netfs_wait_for_pause(rreq); + netfs_wait_for_paused_read(rreq); if (test_bit(NETFS_RREQ_FAILED, &rreq->flags)) break; - if (test_bit(NETFS_RREQ_BLOCKED, &rreq->flags) && - test_bit(NETFS_RREQ_NONBLOCK, &rreq->flags)) - break; cond_resched(); } while (size > 0); diff --cc include/linux/netfs.h index cf634c28522d5,c3f230732f51d..7a649cfedc096 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@@ -48,10 -48,10 +48,9 @@@ enum netfs_io_source NETFS_INVALID_READ, NETFS_UPLOAD_TO_SERVER, NETFS_WRITE_TO_CACHE, - NETFS_INVALID_WRITE, } __mode(byte); - typedef void (*netfs_io_terminated_t)(void *priv, ssize_t transferred_or_error, - bool was_async); + typedef void (*netfs_io_terminated_t)(void *priv, ssize_t transferred_or_error); /* * Per-inode context. This wraps the VFS inode. @@@ -266,10 -268,13 +266,10 @@@ struct netfs_io_request unsigned long flags; #define NETFS_RREQ_OFFLOAD_COLLECTION 0 /* Offload collection to workqueue */ #define NETFS_RREQ_NO_UNLOCK_FOLIO 2 /* Don't unlock no_unlock_folio on completion */ -#define NETFS_RREQ_DONT_UNLOCK_FOLIOS 3 /* Don't unlock the folios on completion */ #define NETFS_RREQ_FAILED 4 /* The request failed */ - #define NETFS_RREQ_IN_PROGRESS 5 /* Unlocked when the request completes */ + #define NETFS_RREQ_IN_PROGRESS 5 /* Unlocked when the request completes (has ref) */ #define NETFS_RREQ_FOLIO_COPY_TO_CACHE 6 /* Copy current folio to cache from read */ #define NETFS_RREQ_UPLOAD_TO_SERVER 8 /* Need to write to the server */ -#define NETFS_RREQ_NONBLOCK 9 /* Don't block if possible (O_NONBLOCK) */ -#define NETFS_RREQ_BLOCKED 10 /* We blocked */ #define NETFS_RREQ_PAUSE 11 /* Pause subrequest generation */ #define NETFS_RREQ_USE_IO_ITER 12 /* Use ->io_iter rather than ->i_pages */ #define NETFS_RREQ_ALL_QUEUED 13 /* All subreqs are now queued */