Skip to contentSkip to conversation

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

PATCH New Trond Myklebust 1 participant 1 message Oct 23, 2007 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20071023123636.6732.patches@notabene

#1 lore raw

PATCH 1/1 NFS: Fix for bug in handling of errors for O_DIRECT writes

From: Neil Brown <[email protected]>

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.

---
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(-)
fs/nfs/direct.c +3 -3
diff .prev/fs/nfs/direct.c ./fs/nfs/direct.c
@@ -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;