Re: [PATCH 1/6] seq_file: add seq_read_iter

Christoph Hellwig
2020-11-11T07:55:48Z

On Tue, Nov 10, 2020 at 11:20:28PM +0000, Al Viro wrote:
> On Tue, Nov 10, 2020 at 09:35:11PM +0000, Al Viro wrote:
> > On Tue, Nov 10, 2020 at 09:32:53PM +0000, Al Viro wrote:
> >
> > > AFAICS, not all callers want that semantics, but I think it's worth
> > > a new primitive. I'm not saying it should be a prereq for your
> > > series, but either that or an explicit iov_iter_revert() is needed.
> >
> > Seeing that it already went into mainline, it needs a followup fix.
> > And since it's not -stable fodder (AFAICS), I'd rather go with
> > adding a new primitive...
>
> Any objections to the following?
>
> Fix seq_read_iter() behaviour on full pipe
>
> generic_file_splice_read() will purge what we'd left in pipe in case
> of error; it will *not* do so in case of short write, so we must make
> sure that reported amount of data stored by ->read_iter() matches the
> reality.
>
> It's not a rare situation (and we already have it open-coded in at least
> one place), so let's introduce a new primitive - copy_to_iter_full().
> Similar to copy_from_iter_full(), it returns true if we had been able
> to copy everything we'd been asked to and false otherwise. Iterator
> is advanced only on success.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Looks ok to me.