diff mbox series

[02/27] lustre: lov: continue fsync on other OST objs even on -ENOENT

Message ID 1681739243-29375-3-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: sync to OpenSFS branch April 17, 2023 | expand

Commit Message

James Simmons April 17, 2023, 1:46 p.m. UTC
From: Bobi Jam <bobijam@whamcloud.com>

When fsync races with truncate, we'd continue to other OST object's
fsync even some stripe fsync returns -ENOENT, so that on client it
could potentially discard caching pages by calling
osc_io_fsync_start()->osc_cache_writebase_range().

WC-bug-id: https://jira.whamcloud.com/browse/LU-16263
Lustre-commit: 927b5cd49c3369d53 ("LU-16263 lov: continue fsync on other OST objs even on -ENOENT")
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50005
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/lov/lov_io.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/lustre/lov/lov_io.c b/fs/lustre/lov/lov_io.c
index 32f028b..4c842cd 100644
--- a/fs/lustre/lov/lov_io.c
+++ b/fs/lustre/lov/lov_io.c
@@ -1013,8 +1013,16 @@  static int lov_io_call(const struct lu_env *env, struct lov_io *lio,
 
 	list_for_each_entry(sub, &lio->lis_active, sub_linkage) {
 		rc = iofunc(sub->sub_env, &sub->sub_io);
-		if (rc)
+		if (rc) {
+			/**
+			 * fsync race with truncate, we'd continue to other
+			 * OST object's fsync to potentially discard
+			 * caching pages (osc_cache_writeback_range).
+			 */
+			if (rc == -ENOENT && parent->ci_type == CIT_FSYNC)
+				continue;
 			break;
+		}
 
 		if (parent->ci_result == 0)
 			parent->ci_result = sub->sub_io.ci_result;