diff options
| author | Jens Axboe <axboe@suse.de> | 2006-04-30 10:36:32 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@suse.de> | 2006-04-30 10:36:32 -0400 |
| commit | 46e678c96bbd775abd05d3ddbe2fd334794f9157 (patch) | |
| tree | f82b77d9f2fd5d4eb5e66bc2bb8ff5df63db3c7f /fs/pipe.c | |
| parent | e0a515bc6a2188f02916e976f419a8640312e32a (diff) | |
[PATCH] splice: fix bugs with stealing regular pipe pages
- Check that page has suitable count for stealing in the regular pipes.
- pipe_to_file() assumes that the page is locked on succesful steal, so
do that in the pipe steal hook
- Missing unlock_page() in add_to_page_cache() failure.
Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'fs/pipe.c')
| -rw-r--r-- | fs/pipe.c | 11 |
1 files changed, 9 insertions, 2 deletions
| @@ -127,8 +127,15 @@ static void anon_pipe_buf_unmap(struct pipe_inode_info *pipe, | |||
| 127 | static int anon_pipe_buf_steal(struct pipe_inode_info *pipe, | 127 | static int anon_pipe_buf_steal(struct pipe_inode_info *pipe, |
| 128 | struct pipe_buffer *buf) | 128 | struct pipe_buffer *buf) |
| 129 | { | 129 | { |
| 130 | buf->flags |= PIPE_BUF_FLAG_STOLEN; | 130 | struct page *page = buf->page; |
| 131 | return 0; | 131 | |
| 132 | if (page_count(page) == 1) { | ||
| 133 | buf->flags |= PIPE_BUF_FLAG_STOLEN; | ||
| 134 | lock_page(page); | ||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | |||
| 138 | return 1; | ||
| 132 | } | 139 | } |
| 133 | 140 | ||
| 134 | static void anon_pipe_buf_get(struct pipe_inode_info *info, | 141 | static void anon_pipe_buf_get(struct pipe_inode_info *info, |
