lkml.org 
[lkml]   [2020]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/6] seq_file: add seq_read_iter
    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@zeniv.linux.org.uk> 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...

    \
     
     \ /
      Last update: 2020-11-12 02:46    [W:5.442 / U:0.688 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site