Skip to content

vmsplice: fix some problems in my previous vmsplice patchset

Askar Safin fuse-devel linux-api linux-fsdevel linux-mm linux-patches lkml netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 6 repliesIn review
  2. v15 patches 3 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7vmsplice: open-code do_writev and do_readvfs/read_write.c+17 -50 replies
2/7vmsplice: change argument type back to "int"fs/read_write.c include/linux/syscalls.h+2 -20 replies
3/7splice: turn wait_for_space flags argument into boolfs/splice.c+3 -30 replies
4/7pipe: move wait_for_space to fs/pipe.c and rename itfs/pipe.c fs/splice.c include/linux/pipe_fs_i.h+20 -180 replies
5/7vmsplice: make sure we don't wait after writing some datafs/read_write.c+37 -20 replies
6/7vmsplice: return -EINVAL for particular combination of flagsfs/read_write.c+10 -00 replies
7/7pipe: set FMODE_NOWAIT for named FIFOsfs/pipe.c+6 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/7] vmsplice: fix some problems in my previous vmsplice patchset

This patchset is for VFS. Of course, it depends on my previous vmsplice patchset ( https://lore.kernel.org/all/[email protected]/ ).

I fix some problems in my previous patchset.

1. Fix problem with CLASS(fd, f)(fd). See first patch in this patchset for details. This is probably not so important, but I fix it anyway.

2. Change "unsigned long" back to "int". See second patch for details. Again, this is probably not important, but I want to fix this anyway.

3. Fix that LTP vmsplice01 bug.

4. libfuse relies on sharing vmsplice behavior. So we detect particular combination of flags to pipe2(2) and vmsplice(2) and return -EINVAL. This forces libfuse to fail back to non-vmsplice code path. I. e. we fix libfuse-related regression [1].
I did debian code search for regex "vmsplice.*SPLICE_F_NONBLOCK" and I found no other packages with this particular combination of flags except for fuse itself. (Okay, other packages are fio and stress-ng, but these are merely testers.) So, I think this is okay to return EINVAL here, breakage will be minimal.

5. Set FMODE_NOWAIT for named FIFOs. CRIU relies on ability to do vmsplice(SPLICE_F_NONBLOCK) on named FIFOs. So, I fix this CRIU-related regression [2]. But there is another CRIU-related regression, which I do not fix [3]: CRIU behavior in splice mode becomes so slow that splice mode becomes useless. I personally still believe that removing vmsplice is right thing to do. Other option is doing nothing. Yet another option is to implement some deprecation period [3]. Let other developers decide.

See patches for details.

Please, run that LTP vmsplice01 test again.

Notes:

- I want to repeat: I change behavior around SPLICE_F_NONBLOCK. Previously, vmsplice ignored whether pipe itself was opened as non-blocking file. Now it is not ignored. And in my opinion new behavior is better.
- vmsplice(2) now is in fs/read_write.c . It is very similar to preadv2 and pwritev2 now, so I think it belongs to fs/read_write.c now.

Please, review this patchset carefully. I'm still new contributor. In particular, please, review that do-while loop, I'm not sure I did everything right.

Tested in Qemu.

[1] https://lore.kernel.org/all/CAJnrk1Y9egYizkx1H9K0cqxSYuB+7vLvQbV7Tf4C5eHFqnnC-A@mail.gmail.com/
[2] https://lore.kernel.org/all/CANaxB-zK5q=Xw6UZTmeFtXsDZjUsPkFk=p485m-wtNTBnf4hgg@mail.gmail.com/
[3] https://lore.kernel.org/all/CANaxB-xUrLQYGiRJZc4Boi+KX=0TJSWymErNovANVko20fMDVA@mail.gmail.com/

v1: https://lore.kernel.org/lkml/[email protected]/

Changes since v1: fix fuse-related and CRIU-related regressions (see above).

Askar Safin (7):
vmsplice: open-code do_writev and do_readv
vmsplice: change argument type back to "int"
splice: turn wait_for_space flags argument into bool
pipe: move wait_for_space to fs/pipe.c and rename it
vmsplice: make sure we don't wait after writing some data
vmsplice: return -EINVAL for particular combination of flags
pipe: set FMODE_NOWAIT for named FIFOs

 fs/pipe.c                 | 23 +++++++++++++
 fs/read_write.c           | 71 +++++++++++++++++++++++++++++++++++----
 fs/splice.c               | 19 +----------
 include/linux/pipe_fs_i.h |  2 ++
 include/linux/syscalls.h  |  2 +-
 5 files changed, 91 insertions(+), 26 deletions(-)

base-commit: 8d86fcfc2857d64af85f5c87c193c25655c970af

Signature · 1 line
2.47.3