Commit d9df8d6b authored by Trond Myklebust's avatar Trond Myklebust

NFS: Don't fail an O_DIRECT read/write if get_user_pages() returns pages

There is no need to fail the entire O_DIRECT read/write just because
get_user_pages() returned fewer pages than we requested.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 070ea602
...@@ -295,10 +295,15 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo ...@@ -295,10 +295,15 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo
break; break;
} }
if ((unsigned)result < data->npages) { if ((unsigned)result < data->npages) {
bytes = result * PAGE_SIZE;
if (bytes <= pgbase) {
nfs_direct_release_pages(data->pagevec, result); nfs_direct_release_pages(data->pagevec, result);
nfs_readdata_release(data); nfs_readdata_release(data);
break; break;
} }
bytes -= pgbase;
data->npages = result;
}
get_dreq(dreq); get_dreq(dreq);
...@@ -630,10 +635,15 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l ...@@ -630,10 +635,15 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l
break; break;
} }
if ((unsigned)result < data->npages) { if ((unsigned)result < data->npages) {
bytes = result * PAGE_SIZE;
if (bytes <= pgbase) {
nfs_direct_release_pages(data->pagevec, result); nfs_direct_release_pages(data->pagevec, result);
nfs_writedata_release(data); nfs_writedata_release(data);
break; break;
} }
bytes -= pgbase;
data->npages = result;
}
get_dreq(dreq); get_dreq(dreq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment