aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/direct.c12
1 files changed, 7 insertions, 5 deletions
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)
532 532
533 spin_lock(&dreq->lock); 533 spin_lock(&dreq->lock);
534 534
535 if (likely(status >= 0)) 535 if (unlikely(status < 0)) {
536 dreq->count += data->res.count; 536 dreq->error = status;
537 else 537 goto out_unlock;
538 dreq->error = task->tk_status; 538 }
539
540 dreq->count += data->res.count;
539 541
540 if (data->res.verf->committed != NFS_FILE_SYNC) { 542 if (data->res.verf->committed != NFS_FILE_SYNC) {
541 switch (dreq->flags) { 543 switch (dreq->flags) {
@@ -550,7 +552,7 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
550 } 552 }
551 } 553 }
552 } 554 }
553 555out_unlock:
554 spin_unlock(&dreq->lock); 556 spin_unlock(&dreq->lock);
555} 557}
556 558