[PATCH] vmsplice: restrict stealing a little more
authorJens Axboe <axboe@suse.de>
Tue, 2 May 2006 13:29:57 +0000 (15:29 +0200)
committerJens Axboe <axboe@suse.de>
Tue, 2 May 2006 13:29:57 +0000 (15:29 +0200)
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>
fs/pipe.c
fs/splice.c
include/linux/pipe_fs_i.h

index 3941a7f78b5d5d778ca72c47d17ba7e18fb77e25..5acd8954aaa0a58a582e3910d1fb1eb50aa5f592 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -184,8 +184,8 @@ void generic_pipe_buf_unmap(struct pipe_inode_info *pipe,
                kunmap(buf->page);
 }
 
-static int anon_pipe_buf_steal(struct pipe_inode_info *pipe,
-                              struct pipe_buffer *buf)
+int generic_pipe_buf_steal(struct pipe_inode_info *pipe,
+                          struct pipe_buffer *buf)
 {
        struct page *page = buf->page;
 
@@ -213,7 +213,7 @@ static struct pipe_buf_operations anon_pipe_buf_ops = {
        .unmap = generic_pipe_buf_unmap,
        .pin = generic_pipe_buf_pin,
        .release = anon_pipe_buf_release,
-       .steal = anon_pipe_buf_steal,
+       .steal = generic_pipe_buf_steal,
        .get = generic_pipe_buf_get,
 };
 
index 3318b965c10bfb97acb920b67eb559ab379fb690..7fb04970c72d853e53874e4ec03d9df48911dcb3 100644 (file)
@@ -141,7 +141,7 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe,
        if (!(buf->flags & PIPE_BUF_FLAG_GIFT))
                return 1;
 
-       return 0;
+       return generic_pipe_buf_steal(pipe, buf);
 }
 
 static struct pipe_buf_operations user_page_pipe_buf_ops = {
index 070954f059479b97d2547e9c23fa3129e5e92d07..ba73108cbf8b038e11ed5e45e8ff54874cb2a1b7 100644 (file)
@@ -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_get(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