summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2019-04-07 13:59:04 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-04-25 14:18:14 -0400
commitaded8d7b54f250af6deb72fde475291cfba513d1 (patch)
treeb1836af68dccf3bc8a4c7163c5503388b260666d
parent22876f540bdf19af9e4fca893ce02ba7ee65ebcc (diff)
NFS: Don't inadvertently clear writeback errors
vfs_fsync() has the side effect of clearing unreported writeback errors, so we need to make sure that we do not abuse it in situations where applications might not normally expect us to report those errors. The solution is to replace calls to vfs_fsync() with calls to nfs_wb_all(). Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--fs/nfs/file.c6
-rw-r--r--fs/nfs/nfs4file.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 4899b85f9b3c..f807e8643ae6 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -147,7 +147,7 @@ nfs_file_flush(struct file *file, fl_owner_t id)
147 return 0; 147 return 0;
148 148
149 /* Flush writes to the server and return any errors */ 149 /* Flush writes to the server and return any errors */
150 return vfs_fsync(file, 0); 150 return nfs_wb_all(inode);
151} 151}
152 152
153ssize_t 153ssize_t
@@ -655,7 +655,7 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from)
655 655
656 /* Return error values */ 656 /* Return error values */
657 if (nfs_need_check_write(file, inode)) { 657 if (nfs_need_check_write(file, inode)) {
658 int err = vfs_fsync(file, 0); 658 int err = nfs_wb_all(inode);
659 if (err < 0) 659 if (err < 0)
660 result = err; 660 result = err;
661 } 661 }
@@ -709,7 +709,7 @@ do_unlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
709 * Flush all pending writes before doing anything 709 * Flush all pending writes before doing anything
710 * with locks.. 710 * with locks..
711 */ 711 */
712 vfs_fsync(filp, 0); 712 nfs_wb_all(inode);
713 713
714 l_ctx = nfs_get_lock_context(nfs_file_open_context(filp)); 714 l_ctx = nfs_get_lock_context(nfs_file_open_context(filp));
715 if (!IS_ERR(l_ctx)) { 715 if (!IS_ERR(l_ctx)) {
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 00d17198ee12..d2846f164997 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -125,7 +125,7 @@ nfs4_file_flush(struct file *file, fl_owner_t id)
125 return filemap_fdatawrite(file->f_mapping); 125 return filemap_fdatawrite(file->f_mapping);
126 126
127 /* Flush writes to the server and return any errors */ 127 /* Flush writes to the server and return any errors */
128 return vfs_fsync(file, 0); 128 return nfs_wb_all(inode);
129} 129}
130 130
131#ifdef CONFIG_NFS_V4_2 131#ifdef CONFIG_NFS_V4_2