* [PATCH 1/2] NFS: Use of mapping_set_error() results in spurious errors
@ 2022-02-15 23:05 trondmy
2022-02-15 23:05 ` [PATCH 2/2] NFS: Do not report writeback errors in nfs_getattr() trondmy
0 siblings, 1 reply; 2+ messages in thread
From: trondmy @ 2022-02-15 23:05 UTC (permalink / raw)
To: linux-nfs
From: Trond Myklebust <trond.myklebust@hammerspace.com>
The use of mapping_set_error() in conjunction with calls to
filemap_check_errors() is problematic because every error gets reported
as either an EIO or an ENOSPC by filemap_check_errors() in functions
such as filemap_write_and_wait() or filemap_write_and_wait_range().
In almost all cases, we prefer to use the more nuanced wb errors.
Fixes: b8946d7bfb94 ("NFS: Revalidate the file mapping on all fatal writeback errors")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
fs/nfs/write.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f88b0eb9b18e..74d258781205 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -316,7 +316,10 @@ static void nfs_mapping_set_error(struct page *page, int error)
struct address_space *mapping = page_file_mapping(page);
SetPageError(page);
- mapping_set_error(mapping, error);
+ filemap_set_wb_err(mapping, error);
+ if (mapping->host)
+ errseq_set(&mapping->host->i_sb->s_wb_err,
+ error == -ENOSPC ? -ENOSPC : -EIO);
nfs_set_pageerror(mapping);
}
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] NFS: Do not report writeback errors in nfs_getattr()
2022-02-15 23:05 [PATCH 1/2] NFS: Use of mapping_set_error() results in spurious errors trondmy
@ 2022-02-15 23:05 ` trondmy
0 siblings, 0 replies; 2+ messages in thread
From: trondmy @ 2022-02-15 23:05 UTC (permalink / raw)
To: linux-nfs
From: Trond Myklebust <trond.myklebust@hammerspace.com>
The result of the writeback, whether it is an ENOSPC or an EIO, or
anything else, does not inhibit the NFS client from reporting the
correct file timestamps.
Fixes: 79566ef018f5 ("NFS: Getattr doesn't require data sync semantics")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
fs/nfs/inode.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 90432fc389a0..f9fc506ebb29 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -850,12 +850,9 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path,
}
/* Flush out writes to the server in order to update c/mtime. */
- if ((request_mask & (STATX_CTIME|STATX_MTIME)) &&
- S_ISREG(inode->i_mode)) {
- err = filemap_write_and_wait(inode->i_mapping);
- if (err)
- goto out;
- }
+ if ((request_mask & (STATX_CTIME | STATX_MTIME)) &&
+ S_ISREG(inode->i_mode))
+ filemap_write_and_wait(inode->i_mapping);
/*
* We may force a getattr if the user cares about atime.
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-15 23:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15 23:05 [PATCH 1/2] NFS: Use of mapping_set_error() results in spurious errors trondmy
2022-02-15 23:05 ` [PATCH 2/2] NFS: Do not report writeback errors in nfs_getattr() trondmy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox