Skip to content

Commit 904abff

Browse files
dhowellsbrauner
authored andcommitted
netfs: Fix read-retry for fs with no ->prepare_read()
Fix netfslib's read-retry to only call ->prepare_read() in the backing filesystem such a function is provided. We can get to this point if a there's an active cache as failed reads from the cache need negotiating with the server instead. Fixes: ee4cdf7 ("netfs: Speed up buffered reading") Signed-off-by: David Howells <[email protected]> Link: https://lore.kernel.org/r/[email protected] cc: Jeff Layton <[email protected]> cc: [email protected] cc: [email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 3f6bc9e commit 904abff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/netfs/read_retry.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq)
152152
BUG_ON(!len);
153153

154154
/* Renegotiate max_len (rsize) */
155-
if (rreq->netfs_ops->prepare_read(subreq) < 0) {
155+
if (rreq->netfs_ops->prepare_read &&
156+
rreq->netfs_ops->prepare_read(subreq) < 0) {
156157
trace_netfs_sreq(subreq, netfs_sreq_trace_reprep_failed);
157158
__set_bit(NETFS_SREQ_FAILED, &subreq->flags);
158159
}

0 commit comments

Comments
 (0)