Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=60fa3f769f7651a60125a0f44e3ffe3246d7cf39
Commit:     60fa3f769f7651a60125a0f44e3ffe3246d7cf39
Parent:     e1552e199857109d4b25b9163eff4646726eee3d
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Sat Apr 14 19:11:52 2007 -0400
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sat Apr 14 21:46:48 2007 -0700

    NFS: Fix two bugs in the O_DIRECT write code
    
    Do not flag an error if the COMMIT call fails and we decide to resend the
    writes. Let the resend flag the error if it fails.
    
    If a write has failed, then nfs_direct_write_result should not attempt to
    send a commit. It should just exit asap and return the error to the user.
    
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
    Cc: Chuck Lever <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/nfs/direct.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index b1c98ea..2877744 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -432,10 +432,10 @@ static void nfs_direct_commit_result(struct rpc_task 
*task, void *calldata)
        if (NFS_PROTO(data->inode)->commit_done(task, data) != 0)
                return;
        if (unlikely(task->tk_status < 0)) {
-               dreq->error = task->tk_status;
+               dprintk("NFS: %5u commit failed with error %d.\n",
+                               task->tk_pid, task->tk_status);
                dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
-       }
-       if (memcmp(&dreq->verf, &data->verf, sizeof(data->verf))) {
+       } else if (memcmp(&dreq->verf, &data->verf, sizeof(data->verf))) {
                dprintk("NFS: %5u commit verify failed\n", task->tk_pid);
                dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
        }
@@ -531,9 +531,12 @@ 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 */
+               dreq->flags = 0;
                dreq->error = status;
-               goto out_unlock;
        }
 
        dreq->count += data->res.count;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to