From: Trond Myklebust Date: Fri, 20 Oct 2006 06:28:38 +0000 (-0700) Subject: [PATCH] NFS: Fix error handling in nfs_direct_write_result() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eda3cef8dd2b83875affe82595db9d0c278879b2;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 9f7f8b9ea1e2..1e873fcab947 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -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); }