NFS: Use of mapping_set_error() results in spurious errors
Subsystems (2)
[email protected]
maintainerPATCH 1/2 NFS: Use of mapping_set_error() results in spurious errors
From: Trond Myklebust <[email protected]>
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 <[email protected]>
--- fs/nfs/write.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfs/write.c +4 -1
@@ -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); }
Signature · 1 line
2.35.1
[email protected]
maintainerPATCH 2/2 NFS: Do not report writeback errors in nfs_getattr()
From: Trond Myklebust <[email protected]>
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 <[email protected]>
--- fs/nfs/inode.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/nfs/inode.c +3 -6
@@ -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.
Signature · 1 line
2.35.1