Skip to content

Commit

Permalink
NFS: Fix up O_DIRECT results
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
trondmypd authored and amschuma-ntap committed Jun 24, 2016
1 parent dd1beb3 commit d2a7de0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit d2a7de0

Please sign in to comment.