The patch titled relayfs: fix overwrites has been added to the -mm tree. Its filename is relayfs-fix-overwrites.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: relayfs: fix overwrites From: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx> When I use relayfs with "overwrite" mode, read() still sets incorrect number of consumed bytes. Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx> Acked-by: Tom Zanussi <zanussi@xxxxxxxxxx> Acked-by: David Wilder <dwilder@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/relay.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff -puN kernel/relay.c~relayfs-fix-overwrites kernel/relay.c --- a/kernel/relay.c~relayfs-fix-overwrites +++ a/kernel/relay.c @@ -812,7 +812,10 @@ static void relay_file_read_consume(stru } buf->bytes_consumed += bytes_consumed; - read_subbuf = read_pos / buf->chan->subbuf_size; + if (!read_pos) + read_subbuf = buf->subbufs_consumed; + else + read_subbuf = read_pos / buf->chan->subbuf_size; if (buf->bytes_consumed + buf->padding[read_subbuf] == subbuf_size) { if ((read_subbuf == buf->subbufs_produced % n_subbufs) && (buf->offset == subbuf_size)) @@ -841,8 +844,9 @@ static int relay_file_read_avail(struct } if (unlikely(produced - consumed >= n_subbufs)) { - consumed = (produced / n_subbufs) * n_subbufs; + consumed = produced - n_subbufs + 1; buf->subbufs_consumed = consumed; + buf->bytes_consumed = 0; } produced = (produced % n_subbufs) * subbuf_size + buf->offset; _ Patches currently in -mm which might be from masami.hiramatsu.pt@xxxxxxxxxxx are relay-file-read-start-pos-fixpatch.patch relayfs-fix-overwrites.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html