]> git.karo-electronics.de Git - karo-tx-linux.git/commit
splice: fix misuse of SPLICE_F_NONBLOCK
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 3 Aug 2010 10:48:50 +0000 (12:48 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 13 Aug 2010 20:19:35 +0000 (13:19 -0700)
commitee1dde6b44b7f8e150e17fdc7d6eea156f8783c5
tree8843d3150dd3fd9959dcea9f79b63fff7b0d38c8
parent0d2952b49bf8ce20c93da5e515e90841b4e66765
splice: fix misuse of SPLICE_F_NONBLOCK

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>
fs/splice.c