LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH]NFS: Fix for bug in handling of errors for O_DIRECT writes
       [not found] <20071023123636.6732.patches@notabene>
@ 2007-10-23 21:09 ` Trond Myklebust
  0 siblings, 0 replies; only message in thread
From: Trond Myklebust @ 2007-10-23 21:09 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Chuck Lever, Neil Brown, nfs, linux-kernel

From: Neil Brown <neilb@suse.de>

commit eda3cef8dd2b838 ensured that if a WRITE returns an error, then
data->res.verf->committed is not tested (as it is not initialised).

commit 60fa3f769f 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>
---
Note: only compile tested - I haven't tried triggering the bug yet.

NeilBrown

### Diffstat output
 ./fs/nfs/direct.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff .prev/fs/nfs/direct.c ./fs/nfs/direct.c
--- .prev/fs/nfs/direct.c	2007-10-23 12:31:29.000000000 +1000
+++ ./fs/nfs/direct.c	2007-10-23 12:32:07.000000000 +1000
@@ -549,13 +549,13 @@ static void nfs_direct_write_result(stru
 
 	spin_lock(&dreq->lock);
 
-	if (unlikely(dreq->error != 0))
-		goto out_unlock;
 	if (unlikely(status < 0)) {
-		/* An error has occured, so we should not commit */
+		/* An error has occurred, so we should not commit */
 		dreq->flags = 0;
 		dreq->error = status;
 	}
+	if (unlikely(dreq->error != 0))
+		goto out_unlock;
 
 	dreq->count += data->res.count;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-23 21:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20071023123636.6732.patches@notabene>
2007-10-23 21:09 ` [PATCH]NFS: Fix for bug in handling of errors for O_DIRECT writes Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).