NFS: Use of mapping_set_error() results in spurious errors
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 15 Feb 2022 20:58:38 +0000 (15:58 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:46 +0000 (14:23 +0200)
commitba3a3390c9b17abd71ac44f4a8f7647f3e4e01fc
treecca8101c41a6f219bd60fe5fba82a432f9709424
parentb59173ff16fbfa94223457cc97cce943867a27db
NFS: Use of mapping_set_error() results in spurious errors

[ Upstream commit 6c984083ec2453dfd3fcf98f392f34500c73e3f2 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/write.c