diff options
Diffstat (limited to 'kernel/relay.c')
-rw-r--r-- | kernel/relay.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/relay.c b/kernel/relay.c index 04006ef970b8..8d13a7855c08 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -944,6 +944,10 @@ static void relay_file_read_consume(struct rchan_buf *buf, | |||
944 | size_t n_subbufs = buf->chan->n_subbufs; | 944 | size_t n_subbufs = buf->chan->n_subbufs; |
945 | size_t read_subbuf; | 945 | size_t read_subbuf; |
946 | 946 | ||
947 | if (buf->subbufs_produced == buf->subbufs_consumed && | ||
948 | buf->offset == buf->bytes_consumed) | ||
949 | return; | ||
950 | |||
947 | if (buf->bytes_consumed + bytes_consumed > subbuf_size) { | 951 | if (buf->bytes_consumed + bytes_consumed > subbuf_size) { |
948 | relay_subbufs_consumed(buf->chan, buf->cpu, 1); | 952 | relay_subbufs_consumed(buf->chan, buf->cpu, 1); |
949 | buf->bytes_consumed = 0; | 953 | buf->bytes_consumed = 0; |
@@ -975,6 +979,8 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) | |||
975 | 979 | ||
976 | relay_file_read_consume(buf, read_pos, 0); | 980 | relay_file_read_consume(buf, read_pos, 0); |
977 | 981 | ||
982 | consumed = buf->subbufs_consumed; | ||
983 | |||
978 | if (unlikely(buf->offset > subbuf_size)) { | 984 | if (unlikely(buf->offset > subbuf_size)) { |
979 | if (produced == consumed) | 985 | if (produced == consumed) |
980 | return 0; | 986 | return 0; |
@@ -993,8 +999,12 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) | |||
993 | if (consumed > produced) | 999 | if (consumed > produced) |
994 | produced += n_subbufs * subbuf_size; | 1000 | produced += n_subbufs * subbuf_size; |
995 | 1001 | ||
996 | if (consumed == produced) | 1002 | if (consumed == produced) { |
1003 | if (buf->offset == subbuf_size && | ||
1004 | buf->subbufs_produced > buf->subbufs_consumed) | ||
1005 | return 1; | ||
997 | return 0; | 1006 | return 0; |
1007 | } | ||
998 | 1008 | ||
999 | return 1; | 1009 | return 1; |
1000 | } | 1010 | } |