Re: [PATCH] netfs: Fix READ/WRITE confusion when calling iov_iter_xarray()

From: Jeff Layton
Date: Fri Aug 13 2021 - 08:53:52 EST


On Mon, 2021-07-26 at 10:58 +0100, David Howells wrote:
> Fix netfs_clear_unread() to pass READ to iov_iter_xarray() instead of WRITE
> (the flag is about the operation accessing the buffer, not what sort of
> access it is doing to the buffer).
>
> Fixes: 3d3c95046742 ("netfs: Provide readahead and readpage netfs helpers")
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> cc: Jeff Layton <jlayton@xxxxxxxxxx>
> cc: linux-cachefs@xxxxxxxxxx
> cc: linux-afs@xxxxxxxxxxxxxxxxxxx
> cc: ceph-devel@xxxxxxxxxxxxxxx
> cc: linux-cifs@xxxxxxxxxxxxxxx
> cc: linux-nfs@xxxxxxxxxxxxxxx
> cc: v9fs-developer@xxxxxxxxxxxxxxxxxxxxx
> cc: linux-fsdevel@xxxxxxxxxxxxxxx
> cc: linux-mm@xxxxxxxxx
> ---
>
> fs/netfs/read_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
> index 0b6cd3b8734c..994ec22d4040 100644
> --- a/fs/netfs/read_helper.c
> +++ b/fs/netfs/read_helper.c
> @@ -150,7 +150,7 @@ static void netfs_clear_unread(struct netfs_read_subrequest *subreq)
> {
> struct iov_iter iter;
>
> - iov_iter_xarray(&iter, WRITE, &subreq->rreq->mapping->i_pages,
> + iov_iter_xarray(&iter, READ, &subreq->rreq->mapping->i_pages,
> subreq->start + subreq->transferred,
> subreq->len - subreq->transferred);
> iov_iter_zero(iov_iter_count(&iter), &iter);
>
>

That's better!

Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>