Commit eda3cef8 authored by Trond Myklebust's avatar Trond Myklebust Committed by Linus Torvalds

[PATCH] NFS: Fix error handling in nfs_direct_write_result()

If the RPC call tanked, we should not be checking the return value
of data->res.verf->committed, since it is unlikely to even be
initialised.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b6dff26a
...@@ -532,10 +532,12 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata) ...@@ -532,10 +532,12 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
spin_lock(&dreq->lock); spin_lock(&dreq->lock);
if (likely(status >= 0)) if (unlikely(status < 0)) {
dreq->error = status;
goto out_unlock;
}
dreq->count += data->res.count; dreq->count += data->res.count;
else
dreq->error = task->tk_status;
if (data->res.verf->committed != NFS_FILE_SYNC) { if (data->res.verf->committed != NFS_FILE_SYNC) {
switch (dreq->flags) { switch (dreq->flags) {
...@@ -550,7 +552,7 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata) ...@@ -550,7 +552,7 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
} }
} }
} }
out_unlock:
spin_unlock(&dreq->lock); spin_unlock(&dreq->lock);
} }
......
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