NFS: Fix up O_DIRECT results
if we read or wrote something, we must report it Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Reviewed-by: Jeff Layton <jlayton@poochiereds.net> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
dd1beb3d16
commit
d2a7de0b34
@ -353,10 +353,12 @@ static ssize_t nfs_direct_wait(struct nfs_direct_req *dreq)
|
||||
|
||||
result = wait_for_completion_killable(&dreq->completion);
|
||||
|
||||
if (!result) {
|
||||
result = dreq->count;
|
||||
WARN_ON_ONCE(dreq->count < 0);
|
||||
}
|
||||
if (!result)
|
||||
result = dreq->error;
|
||||
if (!result)
|
||||
result = dreq->count;
|
||||
|
||||
out:
|
||||
return (ssize_t) result;
|
||||
@ -386,8 +388,10 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
|
||||
|
||||
if (dreq->iocb) {
|
||||
long res = (long) dreq->error;
|
||||
if (!res)
|
||||
if (dreq->count != 0) {
|
||||
res = (long) dreq->count;
|
||||
WARN_ON_ONCE(dreq->count < 0);
|
||||
}
|
||||
dreq->iocb->ki_complete(dreq->iocb, res, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user