[Devel] [PATCH RHEL7 COMMIT] ms/btrfs: minimal conversion to errseq_t writeback error reporting on fsync

Konstantin Khorenko khorenko at virtuozzo.com
Sat Jun 9 13:29:40 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.vz7.48.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.el7
------>
commit b9a126888bdccd6a90e0615555901d32563a1bbb
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Sat Jun 9 13:29:39 2018 +0300

    ms/btrfs: minimal conversion to errseq_t writeback error reporting on fsync
    
    mainline commit 333427a ("btrfs: minimal conversion to errseq_t writeback error reporting on fsync")
    
    Just check and advance the errseq_t in the file before returning, and
    use an errseq_t based check for writeback errors.
    
    Other internal callers of filemap_* functions are left as-is.
    
    Signed-off-by: Jeff Layton <jlayton at redhat.com>
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 fs/btrfs/file.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 7511b3568c77..6a1e61bfed40 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1969,7 +1969,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_log_ctx ctx;
-	int ret = 0;
+	int ret = 0, err;
 	bool full_sync = 0;
 	u64 len;
 
@@ -1988,7 +1988,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 	 */
 	ret = start_ordered_ops(inode, start, end);
 	if (ret)
-		return ret;
+		goto out;
 
 	mutex_lock(&inode->i_mutex);
 	atomic_inc(&root->log_batch);
@@ -2093,10 +2093,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 		 * An ordered extent might have started before and completed
 		 * already with io errors, in which case the inode was not
 		 * updated and we end up here. So check the inode's mapping
-		 * flags for any errors that might have happened while doing
-		 * writeback of file data.
+		 * for any errors that might have happened since we last
+		 * checked called fsync.
 		 */
-		ret = filemap_check_errors(inode->i_mapping);
+		ret = filemap_check_wb_err(inode->i_mapping, file->f_wb_err);
 		mutex_unlock(&inode->i_mutex);
 		goto out;
 	}
@@ -2185,6 +2185,9 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 		ret = btrfs_end_transaction(trans, root);
 	}
 out:
+	err = file_check_and_advance_wb_err(file);
+	if (!ret)
+		ret = err;
 	return ret > 0 ? -EIO : ret;
 }
 


More information about the Devel mailing list