• Jason A. Donenfeld's avatar
    fs: check FMODE_LSEEK to control internal pipe splicing · 97ef77c5
    Jason A. Donenfeld authored
    The original direct splicing mechanism from Jens required the input to
    be a regular file because it was avoiding the special socket case. It
    also recognized blkdevs as being close enough to a regular file. But it
    forgot about chardevs, which behave the same way and work fine here.
    
    This is an okayish heuristic, but it doesn't totally work. For example,
    a few chardevs should be spliceable here. And a few regular files
    shouldn't. This patch fixes this by instead checking whether FMODE_LSEEK
    is set, which represents decently enough what we need rewinding for when
    splicing to internal pipes.
    
    Fixes: b92ce558 ("[PATCH] splice: add direct fd <-> fd splicing support")
    Cc: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    97ef77c5
splice.c 38.8 KB