diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-06-17 16:48:22 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2016-06-24 12:01:00 -0400 |
commit | d2a7de0b34cd255f23d4b7a7f065677f4b1c15f2 (patch) | |
tree | 7abc61c17cb165cd70783488655d0931b9b06149 /fs | |
parent | dd1beb3d16f6a10683b84b89a4644065c43910f3 (diff) | |
download | op-kernel-dev-d2a7de0b34cd255f23d4b7a7f065677f4b1c15f2.zip op-kernel-dev-d2a7de0b34cd255f23d4b7a7f065677f4b1c15f2.tar.gz |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/direct.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 979b3c4..c7326c2 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -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); } |