Skip to content

Commit

Permalink
NFS: Fix for bug in handling of errors for O_DIRECT writes
Browse files Browse the repository at this point in the history
Commit eda3cef ("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 60fa3f7 ("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>
  • Loading branch information
Neil Brown authored and Linus Torvalds committed Oct 23, 2007
1 parent a7aed1c commit 432409e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,13 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)

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;

Expand Down

0 comments on commit 432409e

Please sign in to comment.