A combination of writeback fixes for both regular NFS and pNFS.
Trond Myklebust (15):
NFS: Revalidate the file size on a fatal write error
NFS: Revalidate the file mapping on all fatal writeback errors
SUNRPC: Remove broken gss_mech_list_pseudoflavors()
NFS: Fix up fsync() when the server rebooted
NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes()
NFSv4: Improve read/write/commit tracing
NFS: Fix fix of show_nfs_errors
pNFS/flexfiles: Record resend attempts on I/O failure
NFS: Clean up generic file read tracepoints
NFS: Clean up generic writeback tracepoints
NFS: Clean up generic file commit tracepoint
pNFS/flexfiles: Add tracing for layout errors
NFS: Improve tracing of permission calls
NFS: When resending after a short write, reset the reply count to zero
NFS: Fix nfs_direct_write_reschedule_io()
fs/nfs/dir.c | 4 +-
fs/nfs/direct.c | 7 +-
fs/nfs/file.c | 37 ++--
fs/nfs/flexfilelayout/flexfilelayout.c | 34 ++--
fs/nfs/nfs3xdr.c | 5 +-
fs/nfs/nfs4trace.c | 4 +
fs/nfs/nfs4trace.h | 202 +++++++++++++++++----
fs/nfs/nfs4xdr.c | 5 +-
fs/nfs/nfstrace.h | 234 +++++++++++++++++--------
fs/nfs/pnfs.h | 8 +-
fs/nfs/pnfs_nfs.c | 7 +-
fs/nfs/read.c | 7 +-
fs/nfs/write.c | 29 ++-
include/linux/sunrpc/auth.h | 2 -
include/linux/sunrpc/gss_api.h | 3 -
net/sunrpc/auth.c | 49 ------
net/sunrpc/auth_gss/auth_gss.c | 1 -
net/sunrpc/auth_gss/gss_mech_switch.c | 29 ---
18 files changed, 415 insertions(+), 252 deletions(-)
--
2.24.1
If we suffer a fatal error upon writing a file, which causes us to
need to revalidate the entire mapping, then we should also revalidate
the file size.
Fixes: d2ceb7e57086 ("NFS: Don't use page_file_mapping after removing the page")
Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/write.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 52cab65f91cf..f5170bc839aa 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -243,7 +243,15 @@ static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int c
/* A writeback failed: mark the page as bad, and invalidate the page cache */
static void nfs_set_pageerror(struct address_space *mapping)
{
+ struct inode *inode = mapping->host;
+
nfs_zap_mapping(mapping->host, mapping);
+ /* Force file size revalidation */
+ spin_lock(&inode->i_lock);
+ NFS_I(inode)->cache_validity |= NFS_INO_REVAL_FORCED |
+ NFS_INO_REVAL_PAGECACHE |
+ NFS_INO_INVALID_SIZE;
+ spin_unlock(&inode->i_lock);
}
static void nfs_mapping_set_error(struct page *page, int error)
--
2.24.1
If a write or commit failed, and the mapping sees a fatal error, we
need to revalidate the contents of that mapping.
Fixes: 06c9fdf3b9f1 ("NFS: On fatal writeback errors, we need to call nfs_inode_remove_request()")
Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/write.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f5170bc839aa..83e6f691368c 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -256,8 +256,11 @@ static void nfs_set_pageerror(struct address_space *mapping)
static void nfs_mapping_set_error(struct page *page, int error)
{
+ struct address_space *mapping = page_file_mapping(page);
+
SetPageError(page);
- mapping_set_error(page_file_mapping(page), error);
+ mapping_set_error(mapping, error);
+ nfs_set_pageerror(mapping);
}
/*
@@ -600,7 +603,6 @@ nfs_lock_and_join_requests(struct page *page)
static void nfs_write_error(struct nfs_page *req, int error)
{
- nfs_set_pageerror(page_file_mapping(req->wb_page));
nfs_mapping_set_error(req->wb_page, error);
nfs_inode_remove_request(req);
nfs_end_page_writeback(req);
@@ -1006,7 +1008,6 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
nfs_list_remove_request(req);
if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) &&
(hdr->good_bytes < bytes)) {
- nfs_set_pageerror(page_file_mapping(req->wb_page));
nfs_mapping_set_error(req->wb_page, hdr->error);
goto remove_req;
}
--
2.24.1