[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a61b9y20.fsf@oc8242746057.ibm.com>
Date: Sat, 18 Feb 2023 09:29:11 +0100
From: Alexander Egorenkov <egorenar@...ux.ibm.com>
To: David Howells <dhowells@...hat.com>
Cc: dhowells@...hat.com, axboe@...nel.dk, david@...hat.com,
hch@...radead.org, hch@....de, hdanton@...a.com, jack@...e.cz,
jgg@...dia.com, jhubbard@...dia.com, jlayton@...nel.org,
linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
logang@...tatee.com, viro@...iv.linux.org.uk, willy@...radead.org,
Marc Hartmayer <mhartmay@...ux.ibm.com>
Subject: Re: [PATCH v14 08/17] splice: Do splice read from a file without
using ITER_PIPE
Hi David,
David Howells <dhowells@...hat.com> writes:
> Does the attached fix the problem for you? The data being written into the
> pipe needs to be limited to the size of the file.
>
> David
>
> diff --git a/mm/filemap.c b/mm/filemap.c
> index c01bbcb9fa92..6362ac697a70 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2948,7 +2948,8 @@ ssize_t filemap_splice_read(struct file *in, loff_t *ppos,
> if (writably_mapped)
> flush_dcache_folio(folio);
>
> - n = splice_folio_into_pipe(pipe, folio, *ppos, len);
> + n = min_t(loff_t, len, isize - *ppos);
> + n = splice_folio_into_pipe(pipe, folio, *ppos, n);
> if (!n)
> goto out;
> len -= n;
Yes, this change fixed the problem.
Thanks
Regards
Alex
Powered by blists - more mailing lists