[PATCH] madvise_willneed -EIO beyond EOF

Linux Kernel Mailing List <[email protected]> Tue, 05 Apr 2005 14:10:24 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1492.1.4, 2005/04/05 11:10:24-03:00, [email protected]

	[PATCH] madvise_willneed -EIO beyond EOF
	
	When the rlim_rss was removed from madvise_willneed, we unintentionally
	changed its error when applied to an area wholly beyond end of file: it
	used to report -EIO (whereas 2.6 reports success), it currently reports
	the confusingly inappropriate -EBADF.  Revert to -EIO in that case.
	
	Signed-off-by: Hugh Dickins <[email protected]>



 filemap.c |    2 ++
 1 files changed, 2 insertions(+)


diff -Nru a/mm/filemap.c b/mm/filemap.c
--- a/mm/filemap.c	2005-04-05 13:03:10 -07:00
+++ b/mm/filemap.c	2005-04-05 13:03:10 -07:00
@@ -2605,6 +2605,8 @@
 		end = vma->vm_end;
 	end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
+	error = -EIO;
+
 	/* round to cluster boundaries if this isn't a "random" area. */
 	if (!VM_RandomReadHint(vma)) {
 		start = CLUSTER_OFFSET(start);