Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <Trond.Myklebust@netapp.com>
Cc: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Trond Myklebust and committed by
Linus Torvalds
60fa3f76 e1552e19

+8 -5
+8 -5
fs/nfs/direct.c
··· 432 432 if (NFS_PROTO(data->inode)->commit_done(task, data) != 0) 433 433 return; 434 434 if (unlikely(task->tk_status < 0)) { 435 - dreq->error = task->tk_status; 435 + dprintk("NFS: %5u commit failed with error %d.\n", 436 + task->tk_pid, task->tk_status); 436 437 dreq->flags = NFS_ODIRECT_RESCHED_WRITES; 437 - } 438 - if (memcmp(&dreq->verf, &data->verf, sizeof(data->verf))) { 438 + } else if (memcmp(&dreq->verf, &data->verf, sizeof(data->verf))) { 439 439 dprintk("NFS: %5u commit verify failed\n", task->tk_pid); 440 440 dreq->flags = NFS_ODIRECT_RESCHED_WRITES; 441 441 } ··· 531 531 532 532 spin_lock(&dreq->lock); 533 533 534 - if (unlikely(status < 0)) { 535 - dreq->error = status; 534 + if (unlikely(dreq->error != 0)) 536 535 goto out_unlock; 536 + if (unlikely(status < 0)) { 537 + /* An error has occured, so we should not commit */ 538 + dreq->flags = 0; 539 + dreq->error = status; 537 540 } 538 541 539 542 dreq->count += data->res.count;