[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: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Trond Myklebust 2006-10-19 23:28:38 -07:00 committed by Linus Torvalds
parent b6dff26a08
commit eda3cef8dd

View File

@ -532,10 +532,12 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
spin_lock(&dreq->lock);
if (likely(status >= 0))
dreq->count += data->res.count;
else
dreq->error = task->tk_status;
if (unlikely(status < 0)) {
dreq->error = status;
goto out_unlock;
}
dreq->count += data->res.count;
if (data->res.verf->committed != NFS_FILE_SYNC) {
switch (dreq->flags) {
@ -550,7 +552,7 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
}
}
}
out_unlock:
spin_unlock(&dreq->lock);
}