From 4d3e83e86abd0bb6f70e50f208c63bcc248c6673 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Sat, 14 May 2011 20:57:12 -0400 Subject: [PATCH] Linux: fix reading files larger than the chunk size Commit 2571b6285d5da8ef62ab38c3a938258ddd7bac4e fixed an issue with the use of tmpfs as a disk cache and ftruncate() on files in AFS. But it introduced a problem reading larger files as reported in RT ticket 129880. What should be compared against the current cache file size is the offset into the current chunk, not the overall offset for the whole file. FIXES: 129880 Reviewed-on: http://gerrit.openafs.org/4656 Reviewed-by: Russ Allbery Tested-by: Russ Allbery Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 8ee33373c1ef24572476d8189a3f6f7505bfc83a) Change-Id: I0349d744a9e16b6448a621fe6f4078b1eb1fa9d2 Reviewed-on: http://gerrit.openafs.org/4664 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/LINUX/osi_vnodeops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 45e0a356a..7c7705ec0 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1427,7 +1427,7 @@ afs_linux_read_cache(struct file *cachefp, struct page *page, /* If we're trying to read a page that's past the end of the disk * cache file, then just return a zeroed page */ - if (offset >= i_size_read(cacheinode)) { + if (AFS_CHUNKOFFSET(offset) >= i_size_read(cacheinode)) { zero_user_segment(page, 0, PAGE_CACHE_SIZE); SetPageUptodate(page); if (task) -- 2.39.5