From: Scott Mayhew <smayhew@redhat.com>
To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/2] nfs: ensure correct writeback errors are returned on close()
Date: Fri, 31 Jul 2020 13:46:13 -0400 [thread overview]
Message-ID: <20200731174614.1299346-2-smayhew@redhat.com> (raw)
In-Reply-To: <20200731174614.1299346-1-smayhew@redhat.com>
nfs_wb_all() calls filemap_write_and_wait(), which uses
filemap_check_errors() to determine the error to return.
filemap_check_errors() only looks at the mapping->flags and will
therefore only return either -ENOSPC or -EIO. To ensure that the
correct error is returned on close(), nfs{,4}_file_flush() should call
file_check_and_advance_wb_err() which looks at the errseq value in
mapping->wb_err.
Fixes: 6fbda89b257f ("NFS: Replace custom error reporting mechanism with
generic one")
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
fs/nfs/file.c | 3 ++-
fs/nfs/nfs4file.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index f96367a2463e..eeef6580052f 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -148,7 +148,8 @@ nfs_file_flush(struct file *file, fl_owner_t id)
return 0;
/* Flush writes to the server and return any errors */
- return nfs_wb_all(inode);
+ nfs_wb_all(inode);
+ return file_check_and_advance_wb_err(file);
}
ssize_t
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 8e5d6223ddd3..77bf9c12734c 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -125,7 +125,8 @@ nfs4_file_flush(struct file *file, fl_owner_t id)
return filemap_fdatawrite(file->f_mapping);
/* Flush writes to the server and return any errors */
- return nfs_wb_all(inode);
+ nfs_wb_all(inode);
+ return file_check_and_advance_wb_err(file);
}
#ifdef CONFIG_NFS_V4_2
--
2.25.4
next prev parent reply other threads:[~2020-07-31 17:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 17:46 [PATCH 0/2] nfs: two writeback error reporting fixes Scott Mayhew
2020-07-31 17:46 ` Scott Mayhew [this message]
2020-07-31 19:16 ` [PATCH 1/2] nfs: ensure correct writeback errors are returned on close() Trond Myklebust
2020-07-31 19:43 ` Scott Mayhew
2020-07-31 19:49 ` Trond Myklebust
2020-07-31 17:46 ` [PATCH 2/2] nfs: nfs_file_write() should check for writeback errors Scott Mayhew
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200731174614.1299346-2-smayhew@redhat.com \
--to=smayhew@redhat.com \
--cc=anna.schumaker@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).