]> git.baikalelectronics.ru Git - kernel.git/commit
fs: check FMODE_LSEEK to control internal pipe splicing
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 29 Jun 2022 13:06:58 +0000 (15:06 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 16 Jul 2022 13:19:16 +0000 (09:19 -0400)
commit08e26e75da752fec29791356fcddad04c2fe95dd
treec17483d04296da08c6a68d745dcf499005f4e7ec
parentd6971b08b2c8f9ab55a4006466db8bb9aa80e0e8
fs: check FMODE_LSEEK to control internal pipe splicing

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: 384b281c128a ("[PATCH] splice: add direct fd <-> fd splicing support")
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/splice.c