From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Miklos Szeredi <mszeredi@suse.cz>,
Jens Axboe <jaxboe@fusionio.com>
Subject: [02/11] splice: fix misuse of SPLICE_F_NONBLOCK
Date: Wed, 11 Aug 2010 16:45:41 -0700 [thread overview]
Message-ID: <20100811234625.083800839@clark.site> (raw)
In-Reply-To: <20100811234809.GA676@kroah.com>
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Miklos Szeredi <miklos@szeredi.hu>
commit 6965031d331a642e31278fa1b5bd47f372ffdd5d upstream.
SPLICE_F_NONBLOCK is clearly documented to only affect blocking on the
pipe. In __generic_file_splice_read(), however, it causes an EAGAIN
if the page is currently being read.
This makes it impossible to write an application that only wants
failure if the pipe is full. For example if the same process is
handling both ends of a pipe and isn't otherwise able to determine
whether a splice to the pipe will fill it or not.
We could make the read non-blocking on O_NONBLOCK or some other splice
flag, but for now this is the simplest fix.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -399,17 +399,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
* If the page isn't uptodate, we may need to start io on it
*/
if (!PageUptodate(page)) {
- /*
- * If in nonblock mode then dont block on waiting
- * for an in-flight io page
- */
- if (flags & SPLICE_F_NONBLOCK) {
- if (!trylock_page(page)) {
- error = -EAGAIN;
- break;
- }
- } else
- lock_page(page);
+ lock_page(page);
/*
* Page was truncated, or invalidated by the
next prev parent reply other threads:[~2010-08-11 23:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 23:48 [00/11] 2.6.27.51-stable review Greg KH
2010-08-11 23:45 ` [01/11] nvram: Fix write beyond end condition; prove to gcc copy is safe Greg KH
2010-08-11 23:45 ` Greg KH [this message]
2010-08-11 23:45 ` [03/11] PCI: disable MSI on VIA K8M800 Greg KH
2010-08-11 23:45 ` [04/11] md/raid10: fix deadlock with unaligned read during resync Greg KH
2010-08-11 23:45 ` [05/11] eCryptfs: Handle ioctl calls with unlocked and compat functions Greg KH
2010-08-11 23:45 ` [06/11] fs/ecryptfs/file.c: introduce missing free Greg KH
2010-08-11 23:45 ` [07/11] signalfd: fill in ssi_int for posix timers and message queues Greg KH
2010-08-11 23:45 ` [08/11] jfs: dont allow os2 xattr namespace overlap with others Greg KH
2010-08-11 23:45 ` [09/11] xen: drop xen_sched_clock in favour of using plain wallclock time Greg KH
2010-08-11 23:45 ` [10/11] bdi: register sysfs bdi device only once per queue Greg KH
2010-08-11 23:45 ` [11/11] mm/backing-dev.c: remove recently-added WARN_ON() Greg KH
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=20100811234625.083800839@clark.site \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jaxboe@fusionio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mszeredi@suse.cz \
--cc=stable-review@kernel.org \
--cc=stable@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
all inboxes | Powered by JetHome®