diff options
author | J. Bruce Fields <bfields@redhat.com> | 2018-01-16 10:08:00 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-16 20:14:44 +0100 |
commit | 103fa74ffa5247439cbdae65c8aaec8e62ef3a05 (patch) | |
tree | 6c85ceed49f34266cf7875d817ff294f40d50587 /fs | |
parent | c8ebc7dd51be8d1ecc34ce43277ec7a6c0405a05 (diff) | |
download | linux-stable-103fa74ffa5247439cbdae65c8aaec8e62ef3a05.tar.gz linux-stable-103fa74ffa5247439cbdae65c8aaec8e62ef3a05.tar.bz2 linux-stable-103fa74ffa5247439cbdae65c8aaec8e62ef3a05.zip |
NFS: commit direct writes even if they fail partially
commit 1b8d97b0a837beaf48a8449955b52c650a7114b4 upstream.
If some of the WRITE calls making up an O_DIRECT write syscall fail,
we neglect to commit, even if some of the WRITEs succeed.
We also depend on the commit code to free the reference count on the
nfs_page taken in the "if (request_commit)" case at the end of
nfs_direct_write_completion(). The problem was originally noticed
because ENOSPC's encountered partway through a write would result in a
closed file being sillyrenamed when it should have been unlinked.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/direct.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index a094b0c34ac3..0da8e64c9d75 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -716,10 +716,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) spin_lock(&dreq->lock); - if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) { - dreq->flags = 0; + if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) dreq->error = hdr->error; - } if (dreq->error == 0) { dreq->count += hdr->good_bytes; if (nfs_write_need_commit(hdr)) { |