aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-12-12 12:36:31 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-12-12 12:56:19 -0500
commitbe7e985804c610fcdcee8730cf42718b8a4e1c41 (patch)
tree37facb834c1269ca07d39f59ed4db603a02222ea /fs/nfs
parent67fad106a219e083c91c79695bd1807dde1bf7b9 (diff)
nfs: fix page dirtying in NFS DIO read codepath
The NFS DIO code will dirty pages that catch read responses in order to handle the case where someone is doing DIO reads into an mmapped buffer. The existing code doesn't really do the right thing though since it doesn't take into account the case where we might be attempting to read past the EOF. Fix the logic in that code to only dirty pages that ended up receiving data from the read. Note too that it really doesn't matter if NFS_IOHDR_ERROR is set or not. All that matters is if the page was altered by the read. Cc: Fred Isaman <iisaman@netapp.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/direct.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 594f4e7e0b9a..0bd7a55a5f07 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -266,13 +266,8 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
266 struct nfs_page *req = nfs_list_entry(hdr->pages.next); 266 struct nfs_page *req = nfs_list_entry(hdr->pages.next);
267 struct page *page = req->wb_page; 267 struct page *page = req->wb_page;
268 268
269 if (!PageCompound(page)) { 269 if (!PageCompound(page) && bytes < hdr->good_bytes)
270 if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) { 270 set_page_dirty(page);
271 if (bytes < hdr->good_bytes)
272 set_page_dirty(page);
273 } else
274 set_page_dirty(page);
275 }
276 bytes += req->wb_bytes; 271 bytes += req->wb_bytes;
277 nfs_list_remove_request(req); 272 nfs_list_remove_request(req);
278 nfs_direct_readpage_release(req); 273 nfs_direct_readpage_release(req);