NFS: Fix for bug in handling of errors for O_DIRECT writes

Commit eda3cef8dd2b83875affe82595db9d0c278879b2 ("NFS: Fix error
handling in nfs_direct_write_result()") ensured that if a WRITE returns
an error, then data->res.verf->committed is not tested (as it is not
initialised).

Then commit 60fa3f769f7651a60125a0f44e3ffe3246d7cf39 ("NFS: Fix two bugs
in the O_DIRECT write code") inadvertently reverted this while fixing
other problems.

So move the test so that we never examine ->committed in an error case,
and fix a speeling error while we are there.

Cc: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Acked-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Neil Brown and committed by Linus Torvalds 432409ee a7aed1c2

+3 -3
+3 -3
fs/nfs/direct.c
··· 549 550 spin_lock(&dreq->lock); 551 552 - if (unlikely(dreq->error != 0)) 553 - goto out_unlock; 554 if (unlikely(status < 0)) { 555 - /* An error has occured, so we should not commit */ 556 dreq->flags = 0; 557 dreq->error = status; 558 } 559 560 dreq->count += data->res.count; 561
··· 549 550 spin_lock(&dreq->lock); 551 552 if (unlikely(status < 0)) { 553 + /* An error has occurred, so we should not commit */ 554 dreq->flags = 0; 555 dreq->error = status; 556 } 557 + if (unlikely(dreq->error != 0)) 558 + goto out_unlock; 559 560 dreq->count += data->res.count; 561