]> err.no Git - linux-2.6/commitdiff
NeilBrown <neilb@suse.de>
authorakpm@linux-foundation.org <akpm@linux-foundation.org>
Mon, 16 Jul 2007 06:38:25 +0000 (23:38 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 16 Jul 2007 16:05:37 +0000 (09:05 -0700)
The do_loop_readv_writev implementation of readv breaks out of the loop as
soon as a single read request didn't fill it's buffer:

if (nr != len)
break;

The generic_file_aio_read version doesn't.  So if it hits EOF before the end
of the list of buffers, it will try again on the next buffer.  If the file was
extended in the mean time, this will produce a bad result.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap.c

index e006c57bda5431325b511e25996b3f910d7b4b8a..adbac104f34c80fdee280438058c2c6b0a8fe857 100644 (file)
@@ -1219,6 +1219,8 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
                                retval = retval ?: desc.error;
                                break;
                        }
+                       if (desc.count > 0)
+                               break;
                }
        }
 out: