From: Pavel Tikhomirov <ptikhomi...@virtuozzo.com>

Add tracking of writeback errors using file_check_and_advance_wb_err()
for each file. This ensures proper error reporting and aligns with
modern error handling practices.

Similar to upstream commit:
95cb67138746 ("ext4: track writeback errors using the generic tracking 
infrastructure")

Part of rework for ext4_sync_files function.

Fixes: 26337aacaafa9 ("ext4: add mfsync support")
https://virtuozzo.atlassian.net/browse/VSTOR-107255
Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com>

Feature: ext4: optimized sync of a set of files - mfsync()
---
 fs/ext4/fsync.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index aea460d805289..38f32d988ad4c 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -283,6 +283,12 @@ int ext4_sync_files(struct file **files, unsigned int 
*flags, unsigned int nr_fi
                }
        }
 out:
+       for (i = 0; i < nr_files; i++) {
+               err3 = file_check_and_advance_wb_err(files[i]);
+               if (!err2 || err3 == -EIO)
+                       err2 = err3;
+       }
+
        trace_ext4_sync_files_exit(files[0]->f_path.dentry, commit_tid, 
need_barrier);
        if (!err || err2 == -EIO)
                err = err2;
-- 
2.43.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to