In demand-read mode, fs using fscache for demand-read doesn't know and care the exact file size of the data blob file, and thus skip the file size check in this case. Signed-off-by: Jeffle Xu <jefflexu@xxxxxxxxxxxxxxxxx> --- fs/netfs/read_helper.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c index af12a7996672..ade1523fc180 100644 --- a/fs/netfs/read_helper.c +++ b/fs/netfs/read_helper.c @@ -776,14 +776,16 @@ netfs_rreq_prepare_read(struct netfs_read_request *rreq, goto out; if (source == NETFS_DOWNLOAD_FROM_SERVER) { - /* Call out to the netfs to let it shrink the request to fit - * its own I/O sizes and boundaries. If it shinks it here, it - * will be called again to make simultaneous calls; if it wants - * to make serial calls, it can indicate a short read and then - * we will call it again. - */ - if (subreq->len > rreq->i_size - subreq->start) - subreq->len = rreq->i_size - subreq->start; + if (rreq->type == NETFS_TYPE_CACHE) { + /* Call out to the netfs to let it shrink the request to fit + * its own I/O sizes and boundaries. If it shinks it here, it + * will be called again to make simultaneous calls; if it wants + * to make serial calls, it can indicate a short read and then + * we will call it again. + */ + if (subreq->len > rreq->i_size - subreq->start) + subreq->len = rreq->i_size - subreq->start; + } if (rreq->netfs_ops->clamp_length && !rreq->netfs_ops->clamp_length(subreq)) { -- 2.27.0