diff options
author | Jens Axboe <axboe@suse.de> | 2006-05-02 09:29:57 -0400 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2006-05-02 09:29:57 -0400 |
commit | 330ab71619bacc4d4494227a6cfc9b7f5500403d (patch) | |
tree | 43a9045011116f1afa506b80de1ede9872f45935 | |
parent | a893b99be71f1d669b74f840e3a683dd077d007b (diff) |
[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: Jens Axboe <axboe@suse.de>
-rw-r--r-- | fs/pipe.c | 6 | ||||
-rw-r--r-- | fs/splice.c | 2 | ||||
-rw-r--r-- | include/linux/pipe_fs_i.h | 1 |
3 files changed, 5 insertions, 4 deletions
@@ -184,8 +184,8 @@ void generic_pipe_buf_unmap(struct pipe_inode_info *pipe, | |||
184 | kunmap(buf->page); | 184 | kunmap(buf->page); |
185 | } | 185 | } |
186 | 186 | ||
187 | static int anon_pipe_buf_steal(struct pipe_inode_info *pipe, | 187 | int generic_pipe_buf_steal(struct pipe_inode_info *pipe, |
188 | struct pipe_buffer *buf) | 188 | struct pipe_buffer *buf) |
189 | { | 189 | { |
190 | struct page *page = buf->page; | 190 | struct page *page = buf->page; |
191 | 191 | ||
@@ -213,7 +213,7 @@ static struct pipe_buf_operations anon_pipe_buf_ops = { | |||
213 | .unmap = generic_pipe_buf_unmap, | 213 | .unmap = generic_pipe_buf_unmap, |
214 | .pin = generic_pipe_buf_pin, | 214 | .pin = generic_pipe_buf_pin, |
215 | .release = anon_pipe_buf_release, | 215 | .release = anon_pipe_buf_release, |
216 | .steal = anon_pipe_buf_steal, | 216 | .steal = generic_pipe_buf_steal, |
217 | .get = generic_pipe_buf_get, | 217 | .get = generic_pipe_buf_get, |
218 | }; | 218 | }; |
219 | 219 | ||
diff --git a/fs/splice.c b/fs/splice.c index 3318b965c10b..7fb04970c72d 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -141,7 +141,7 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe, | |||
141 | if (!(buf->flags & PIPE_BUF_FLAG_GIFT)) | 141 | if (!(buf->flags & PIPE_BUF_FLAG_GIFT)) |
142 | return 1; | 142 | return 1; |
143 | 143 | ||
144 | return 0; | 144 | return generic_pipe_buf_steal(pipe, buf); |
145 | } | 145 | } |
146 | 146 | ||
147 | static struct pipe_buf_operations user_page_pipe_buf_ops = { | 147 | static struct pipe_buf_operations user_page_pipe_buf_ops = { |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 070954f05947..ba73108cbf8b 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -69,6 +69,7 @@ void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); | |||
69 | void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *); | 69 | void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *); |
70 | void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); | 70 | void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); |
71 | int generic_pipe_buf_pin(struct pipe_inode_info *, struct pipe_buffer *); | 71 | int generic_pipe_buf_pin(struct pipe_inode_info *, struct pipe_buffer *); |
72 | int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); | ||
72 | 73 | ||
73 | /* | 74 | /* |
74 | * splice is tied to pipes as a transport (at least for now), so we'll just | 75 | * splice is tied to pipes as a transport (at least for now), so we'll just |