tracing: Do not block on splice if either file or splice NONBLOCK flag is set
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Fri, 1 Mar 2013 01:03:06 +0000 (20:03 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Mar 2013 04:34:48 +0000 (00:34 -0400)
Currently only the splice NONBLOCK flag is checked to determine if
the splice read should block or not. But the file descriptor NONBLOCK
flag also needs to be checked.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c

index ab3df804fa96a9b109e80f0891a9a2f2de933fc3..598a7aa7d0ae9f81d74205b11c0728629aee6f94 100644 (file)
@@ -4593,7 +4593,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
 
        /* did we read anything? */
        if (!spd.nr_pages) {
-               if (flags & SPLICE_F_NONBLOCK)
+               if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK))
                        ret = -EAGAIN;
                else
                        ret = 0;