Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2281

kernel-2.6.18-238.el5.src.rpm

From: Amerigo Wang <amwang@redhat.com>
Date: Wed, 24 Jun 2009 22:23:32 -0400
Subject: [mm] readv: sometimes returns less than it should
Message-id: 20090625022544.6017.42083.sendpatchset@localhost.localdomain
O-Subject: [PATCH RHEL5.x] readv: sometimes returns less than it should
Bugzilla: 500693
RH-Acked-by: Pete Zaitcev <zaitcev@redhat.com>
RH-Acked-by: Eric Sandeen <sandeen@redhat.com>

BZ500693

Description:
With the test program attached in
https://bugzilla.redhat.com/show_bug.cgi?id=500693
we can see the failure after running it less than 1000 times, readv()
returns less than it is supposed to. E.g.

...
Test[3]: xfr=640 != 2048, zero read.
Expected 0 exit status - failed.
Test failed.

Upstream status:
commit c44939ecb6e05aeaaf12d4e1bb046719c97e457e is the fix.

Test status:
After running the test program more than 20000 times, I can't reproduce
this bug any more.

Please review and Ack.

diff --git a/mm/filemap.c b/mm/filemap.c
index 87900f6..44661d7 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1258,6 +1258,8 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
 				retval = retval ?: desc.error;
 				break;
 			}
+			if (desc.count > 0)
+				break;
 		}
 	}
 out: