summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2018-01-16 10:08:00 -0500
committerSasha Levin <alexander.levin@microsoft.com>2018-02-28 22:09:51 -0500
commitcfdf2414b1f6d133e60c56cf87458dd1a9d8aba7 (patch)
tree0111d3335541e687db93f2b39ab2a7d3f0d67b5c /fs
parentf40a0ab97f72ec6ed5c97b0e72061038623129a4 (diff)
NFS: commit direct writes even if they fail partially
[ Upstream commit 1b8d97b0a837beaf48a8449955b52c650a7114b4 ] 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> Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/direct.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 38678d9a5cc4..cb050d1e8146 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -784,10 +784,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) {
nfs_direct_good_bytes(dreq, hdr);
if (nfs_write_need_commit(hdr)) {