mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 13:00:54 +07:00
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>
This commit is contained in:
parent
67fad106a2
commit
be7e985804
@ -266,13 +266,8 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
|
|||||||
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
|
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
|
||||||
struct page *page = req->wb_page;
|
struct page *page = req->wb_page;
|
||||||
|
|
||||||
if (!PageCompound(page)) {
|
if (!PageCompound(page) && bytes < hdr->good_bytes)
|
||||||
if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
|
set_page_dirty(page);
|
||||||
if (bytes < hdr->good_bytes)
|
|
||||||
set_page_dirty(page);
|
|
||||||
} else
|
|
||||||
set_page_dirty(page);
|
|
||||||
}
|
|
||||||
bytes += req->wb_bytes;
|
bytes += req->wb_bytes;
|
||||||
nfs_list_remove_request(req);
|
nfs_list_remove_request(req);
|
||||||
nfs_direct_readpage_release(req);
|
nfs_direct_readpage_release(req);
|
||||||
|
Loading…
Reference in New Issue
Block a user