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

James Simmons <[email protected]> Mon, 17 Apr 2023 09:46:58 -0400
Newsgroups org.lustre.lists.lustre-devel
Message-ID <[email protected]>
From: Bobi Jam <[email protected]>

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 <[email protected]>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50005
Reviewed-by: Andreas Dilger <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Reviewed-by: Alex Zhuravlev <[email protected]>
Signed-off-by: James Simmons <[email protected]>
---
 fs/lustre/lov/lov_io.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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;
-- 
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org