Cache bypass: make readpage deal with reads at end of file
[openafs.git] / src / afs / LINUX / osi_vnodeops.c
index 7489529..780c8ef 100644 (file)
@@ -1820,6 +1820,17 @@ afs_linux_bypass_readpage(struct file *fp, struct page *pp)
     struct nocache_read_request *ancr;
     int code;
 
+    /*
+     * Special case: if page is at or past end of file, just zero it and set
+     * it as up to date.
+     */
+    if (page_offset(pp) >=  i_size_read(fp->f_mapping->host)) {
+       zero_user_segment(pp, 0, PAGE_CACHE_SIZE);
+       SetPageUptodate(pp);
+       unlock_page(pp);
+       return 0;
+    }
+
     ClearPageError(pp);
 
     /* receiver frees */