mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	xiaosuo <xiaosuo@gmail.com>
Subject: PATCH: sendfile() checks f_op.sendpage() instead of f_op.splice_write() wrongly
Date: Mon, 19 Oct 2009 15:56:30 +0800	[thread overview]
Message-ID: <4ADC1BAE.9060508@gmail.com> (raw)

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;



             reply	other threads:[~2009-10-19  7:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19  7:56 Changli Gao [this message]
2009-10-19  8:25 ` Jens Axboe
2009-10-19  8:48   ` Changli Gao
2009-10-19  9:20 ` Changli Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ADC1BAE.9060508@gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome