|
@@ -127,8 +127,15 @@ static void anon_pipe_buf_unmap(struct pipe_inode_info *pipe,
|
|
|
static int anon_pipe_buf_steal(struct pipe_inode_info *pipe,
|
|
|
struct pipe_buffer *buf)
|
|
|
{
|
|
|
- buf->flags |= PIPE_BUF_FLAG_STOLEN;
|
|
|
- return 0;
|
|
|
+ struct page *page = buf->page;
|
|
|
+
|
|
|
+ if (page_count(page) == 1) {
|
|
|
+ buf->flags |= PIPE_BUF_FLAG_STOLEN;
|
|
|
+ lock_page(page);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
static void anon_pipe_buf_get(struct pipe_inode_info *info,
|