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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 11, 2020 at 02:27:02PM -0800, Linus Torvalds wrote:
> On Wed, Nov 11, 2020 at 2:21 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Something like below (build-tested only):
> 
> Apart from my usual "oh, Gods, the iter model really does confuse me"
> this looks more like what I expected, yes.
> 
> Considering the original bug, I'm clearly not the only one confused by
> the iov_iter helper functions and the rules..

copy_to_iter() returns the amount it has actually copied, that's all;
the cause of that bug is not the primitives used, it's the rules for
->read_iter().  The rules are actually fairly simple - "->read_iter()
should not report less data than it has actually left there".  For read(2)
it's a matter of QoI - if we hit an unmapped page, POSIX pretty much says
that all bets are off; read(fd, unmapped - 5, 8) might copy 5 bytes and
return 4.  It is allowed (and read(2) on those files used to do just that),
but it's nicer not to do so.  For generic_file_splice_read(), OTOH, it's
a bug - we end up with stray data spewed into pipe.  So converting
to ->read_iter() needs some care.  Probably something along those
lines should go into D/f/porting...



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux