All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: sendfile() checks f_op.sendpage() instead of f_op.splice_write() wrongly
@ 2009-10-19  7:56 Changli Gao
  2009-10-19  8:25 ` Jens Axboe
  2009-10-19  9:20 ` Changli Gao
  0 siblings, 2 replies; 4+ messages in thread
From: Changli Gao @ 2009-10-19  7:56 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel Mailing List, xiaosuo

sendfile(2) checks f_op.sendpage() instead of f_op.splice_write() wrongly.

sendfile(2) was reworked with the splice infrastructure, but it still
checks f_op.sendpage() instead of f_op.splice_write() wrongly. Although
if f_op.sendpage() exists, f_op.splice_write() always exists at the same
time currently, the assumption will be broken in future silently. This
patch also brings a side effect: sendfile(2) can work with any output
file, which supports splice_write() not only mmap(2).

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
fs/read_write.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -826,7 +826,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
 	if (!(out_file->f_mode & FMODE_WRITE))
 		goto fput_out;
 	retval = -EINVAL;
-	if (!out_file->f_op || !out_file->f_op->sendpage)
+	if (!out_file->f_op || !out_file->f_op->splice_write)
 		goto fput_out;
 	in_inode = in_file->f_path.dentry->d_inode;
 	out_inode = out_file->f_path.dentry->d_inode;



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-19  9:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-19  7:56 PATCH: sendfile() checks f_op.sendpage() instead of f_op.splice_write() wrongly Changli Gao
2009-10-19  8:25 ` Jens Axboe
2009-10-19  8:48   ` Changli Gao
2009-10-19  9:20 ` Changli Gao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.