mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
nfs: ensure correct writeback errors are returned on close()
[ Upstream commit67dd23f9e6] 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 filemap_check_wb_err() which looks at the errseq value in mapping->wb_err without consuming it. Fixes:6fbda89b25("NFS: Replace custom error reporting mechanism with generic one") Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9153e0d437
commit
7dccbf1111
@@ -140,6 +140,7 @@ static int
|
||||
nfs_file_flush(struct file *file, fl_owner_t id)
|
||||
{
|
||||
struct inode *inode = file_inode(file);
|
||||
errseq_t since;
|
||||
|
||||
dprintk("NFS: flush(%pD2)\n", file);
|
||||
|
||||
@@ -148,7 +149,9 @@ 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);
|
||||
since = filemap_sample_wb_err(file->f_mapping);
|
||||
nfs_wb_all(inode);
|
||||
return filemap_check_wb_err(file->f_mapping, since);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
|
||||
@@ -109,6 +109,7 @@ static int
|
||||
nfs4_file_flush(struct file *file, fl_owner_t id)
|
||||
{
|
||||
struct inode *inode = file_inode(file);
|
||||
errseq_t since;
|
||||
|
||||
dprintk("NFS: flush(%pD2)\n", file);
|
||||
|
||||
@@ -124,7 +125,9 @@ 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);
|
||||
since = filemap_sample_wb_err(file->f_mapping);
|
||||
nfs_wb_all(inode);
|
||||
return filemap_check_wb_err(file->f_mapping, since);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NFS_V4_2
|
||||
|
||||
Reference in New Issue
Block a user