From 1b694ad04f099924cb5760cbaf1f09e5843975aa Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Sun, 24 Sep 2023 00:18:36 +0800 Subject: [PATCH] LU-16896 flr: resync could mess mirror content This could happens in this case: a component with extent [0, 0x1000) being synced with another mirror with data in [0x100, 0x200) and file size is 0x300. The out-of-sync mirror will get punched in [0, 0x100) and data being correctly written in [0x100, 0x200), but will be missed the punch in [0x200, 0x300) even though it can be correctly truncated at 0x300. Fixes: b9ce342ee1 ("LU-16896 flr: resync should not change file size") Signed-off-by: Bobi Jam Change-Id: If81433260f42c6161a53157cc0dd9d115eabbfb9 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52489 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Mikhail Pershin Reviewed-by: Oleg Drokin --- lustre/utils/liblustreapi_layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/utils/liblustreapi_layout.c b/lustre/utils/liblustreapi_layout.c index 8155578..374e9e1 100644 --- a/lustre/utils/liblustreapi_layout.c +++ b/lustre/utils/liblustreapi_layout.c @@ -3086,7 +3086,7 @@ int llapi_mirror_resync_many_params(int fd, struct llapi_layout *layout, */ rc = llapi_mirror_truncate(fd, mid, cur_pos); - else if (data_size) + else if (to_punch) rc = llapi_mirror_punch(fd, mid, cur_pos, to_punch); /** -- 1.8.3.1