Skip to contentSkip to conversation

fs/splice: ignore flag SPLICE_F_GIFT in syscall vmsplice

PATCH In review Konstantin Khlebnikov 2 participants 2 messages Nov 14, 2019 – Nov 27, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fs/splice: ignore flag SPLICE_F_GIFT in syscall vmsplice

Generic support of flag SPLICE_F_MOVE in syscall splice was removed in kernel 2.6.21 commit 485ddb4b9741 ("1/2 splice: dont steal"). Infrastructure stay intact and this feature may came back. At least driver or filesystem could provide own implementation.

But stealing mapped pages from userspace never worked and is very unlikely that will ever make sense due to unmapping overhead. Also lru handling is broken if gifted anon page spliced into file.

Let's seal entry point for marking page as a gift in vmsplice.

v2: remove PIPE_BUF_FLAG_GIFT and related dead code.

---
 fs/fuse/dev.c             |    1 -
 fs/splice.c               |   41 +++--------------------------------------
 include/linux/pipe_fs_i.h |    1 -
 3 files changed, 3 insertions(+), 40 deletions(-)
fs/fuse/dev.c +0 -1
index ed1abc9e33cf..aacc4fa639ba 100644
@@ -1987,7 +1987,6 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
 				goto out_free;
 
 			*obuf = *ibuf;
-			obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
 			obuf->len = rem;
 			ibuf->offset += obuf->len;
 			ibuf->len -= obuf->len;
fs/splice.c +3 -38

79 lines not on this page · raw message

include/linux/pipe_fs_i.h +0 -1
index 5c626fdc10db..1a3a5efb9c6f 100644
@@ -6,7 +6,6 @@
 
 #define PIPE_BUF_FLAG_LRU	0x01	/* page is on the LRU */
 #define PIPE_BUF_FLAG_ATOMIC	0x02	/* was atomically mapped */
-#define PIPE_BUF_FLAG_GIFT	0x04	/* page is a gift */
 #define PIPE_BUF_FLAG_PACKET	0x08	/* read() as a packet */
 
 /**