Commit 330ab716 authored by Jens Axboe's avatar Jens Axboe

[PATCH] vmsplice: restrict stealing a little more

Apply the same rules as the anon pipe pages, only allow stealing
if no one else is using the page.
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
parent a893b99b
...@@ -184,8 +184,8 @@ void generic_pipe_buf_unmap(struct pipe_inode_info *pipe, ...@@ -184,8 +184,8 @@ void generic_pipe_buf_unmap(struct pipe_inode_info *pipe,
kunmap(buf->page); kunmap(buf->page);
} }
static int anon_pipe_buf_steal(struct pipe_inode_info *pipe, int generic_pipe_buf_steal(struct pipe_inode_info *pipe,
struct pipe_buffer *buf) struct pipe_buffer *buf)
{ {
struct page *page = buf->page; struct page *page = buf->page;
...@@ -213,7 +213,7 @@ static struct pipe_buf_operations anon_pipe_buf_ops = { ...@@ -213,7 +213,7 @@ static struct pipe_buf_operations anon_pipe_buf_ops = {
.unmap = generic_pipe_buf_unmap, .unmap = generic_pipe_buf_unmap,
.pin = generic_pipe_buf_pin, .pin = generic_pipe_buf_pin,
.release = anon_pipe_buf_release, .release = anon_pipe_buf_release,
.steal = anon_pipe_buf_steal, .steal = generic_pipe_buf_steal,
.get = generic_pipe_buf_get, .get = generic_pipe_buf_get,
}; };
......
...@@ -141,7 +141,7 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe, ...@@ -141,7 +141,7 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe,
if (!(buf->flags & PIPE_BUF_FLAG_GIFT)) if (!(buf->flags & PIPE_BUF_FLAG_GIFT))
return 1; return 1;
return 0; return generic_pipe_buf_steal(pipe, buf);
} }
static struct pipe_buf_operations user_page_pipe_buf_ops = { static struct pipe_buf_operations user_page_pipe_buf_ops = {
......
...@@ -69,6 +69,7 @@ void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); ...@@ -69,6 +69,7 @@ void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int);
void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *); void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *);
void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
int generic_pipe_buf_pin(struct pipe_inode_info *, struct pipe_buffer *); int generic_pipe_buf_pin(struct pipe_inode_info *, struct pipe_buffer *);
int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
/* /*
* splice is tied to pipes as a transport (at least for now), so we'll just * splice is tied to pipes as a transport (at least for now), so we'll just
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment