• Pavel Emelyanov's avatar
    page-server: Allow blocking on socket · a99b7c1b
    Pavel Emelyanov authored
    When splicing page server data from UNIX socket we may get
    error (EAGAIN) from splice if no data is available on the
    socket yet. This is because the SPLICE_F_NONBLOCK flag is
    checked by af_unix.c in the kernel to decide whether or
    not to do blocking read.
    
    This is not symmetrical with TCP sockets, which only check
    for the socket's O_NONBLOCK flag for the same decicion.
    
    Dropping the SPLICE_F_NONBLOCK flag is not possible too, as
    otherwise we'll block on the pipe when trying to put data
    into it. Even if part of the data fits into it kernel would
    block anyway untill full buffer is in. And there will be
    no read() from the pipe, as it should happen one step later
    in the same task.
    
    So to untie this, we need to wait for the data explicitly
    with poll().
    Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    a99b7c1b
page-xfer.c 16.5 KB