aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/trace/trace.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8fb4847b0450..77eeab2776ef 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5930,9 +5930,6 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
5930 return -EBUSY; 5930 return -EBUSY;
5931#endif 5931#endif
5932 5932
5933 if (splice_grow_spd(pipe, &spd))
5934 return -ENOMEM;
5935
5936 if (*ppos & (PAGE_SIZE - 1)) 5933 if (*ppos & (PAGE_SIZE - 1))
5937 return -EINVAL; 5934 return -EINVAL;
5938 5935
@@ -5942,6 +5939,9 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
5942 len &= PAGE_MASK; 5939 len &= PAGE_MASK;
5943 } 5940 }
5944 5941
5942 if (splice_grow_spd(pipe, &spd))
5943 return -ENOMEM;
5944
5945 again: 5945 again:
5946 trace_access_lock(iter->cpu_file); 5946 trace_access_lock(iter->cpu_file);
5947 entries = ring_buffer_entries_cpu(iter->trace_buffer->buffer, iter->cpu_file); 5947 entries = ring_buffer_entries_cpu(iter->trace_buffer->buffer, iter->cpu_file);
@@ -5999,19 +5999,21 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
5999 /* did we read anything? */ 5999 /* did we read anything? */
6000 if (!spd.nr_pages) { 6000 if (!spd.nr_pages) {
6001 if (ret) 6001 if (ret)
6002 return ret; 6002 goto out;
6003 6003
6004 ret = -EAGAIN;
6004 if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) 6005 if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK))
6005 return -EAGAIN; 6006 goto out;
6006 6007
6007 ret = wait_on_pipe(iter, true); 6008 ret = wait_on_pipe(iter, true);
6008 if (ret) 6009 if (ret)
6009 return ret; 6010 goto out;
6010 6011
6011 goto again; 6012 goto again;
6012 } 6013 }
6013 6014
6014 ret = splice_to_pipe(pipe, &spd); 6015 ret = splice_to_pipe(pipe, &spd);
6016out:
6015 splice_shrink_spd(&spd); 6017 splice_shrink_spd(&spd);
6016 6018
6017 return ret; 6019 return ret;