summaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
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 /fs/nfs/file.c
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>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c6
1 files changed, 3 insertions, 3 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)) {