]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
splice: lift pipe_lock out of splice_to_pipe()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 18 Sep 2016 00:44:45 +0000 (20:44 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 4 Oct 2016 00:40:55 +0000 (20:40 -0400)
commit8924feff66f35fe22ce77aafe3f21eb8e5cff881
tree77d74a5edba4d1a30f484e0cffdecfcfcc113d79
parentdb85a9eb2e364e24e71f94798e85dbaa8111bb4d
splice: lift pipe_lock out of splice_to_pipe()

* splice_to_pipe() stops at pipe overflow and does *not* take pipe_lock
* ->splice_read() instances do the same
* vmsplice_to_pipe() and do_splice() (ultimate callers of splice_to_pipe())
  arrange for waiting, looping, etc. themselves.

That should make pipe_lock the outermost one.

Unfortunately, existing rules for the amount passed by vmsplice_to_pipe()
and do_splice() are quite ugly _and_ userland code can be easily broken
by changing those.  It's not even "no more than the maximal capacity of
this pipe" - it's "once we'd fed pipe->nr_buffers pages into the pipe,
leave instead of waiting".

Considering how poorly these rules are documented, let's try "wait for some
space to appear, unless given SPLICE_F_NONBLOCK, then push into pipe
and if we run into overflow, we are done".

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/fuse/dev.c
fs/splice.c