Skip to content

Commit

Permalink
[PATCH] NFS: Fix error handling in nfs_direct_write_result()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trond Myklebust authored and Linus Torvalds committed Oct 20, 2006
1 parent b6dff26 commit eda3cef
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -550,7 +552,7 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
}
}
}

out_unlock:
spin_unlock(&dreq->lock);
}

Expand Down

0 comments on commit eda3cef

Please sign in to comment.