From 8ecf9e229cf59def03bb9368ec88228ff6e943f0 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Wed, 29 Apr 2020 17:14:04 +0800 Subject: [PATCH] LU-12586 lov: one more fix to write_intent end for trunc This patch fixes another case where the truncate write intent extent is set incorrectly. This may cause errors when truncating PFL files to exactly the boundary between two extents. Fixes: c32c7401426d ("LU-12586 lov: Correct write_intent end for trunc") Signed-off-by: Bobi Jam Change-Id: I40f14a48c53bfd1e6442e4414ee30f9eb159fc02 Reviewed-on: https://review.whamcloud.com/38412 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Wang Shilong Reviewed-by: Li Dongyang Reviewed-by: Andreas Dilger --- lustre/lov/lov_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index ef9e5bb..ce87872 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -373,11 +373,12 @@ static int lov_io_mirror_init(struct lov_io *lio, struct lov_object *obj, /** * for truncate, we uses [size, EOF) to judge whether * a write intent needs to be send, but we need to - * restore the write extent to [0, size). + * restore the write extent to [0, size], in truncate, + * the byte in the size position is accessed. */ io->ci_write_intent.e_start = 0; io->ci_write_intent.e_end = - io->u.ci_setattr.sa_attr.lvb_size; + io->u.ci_setattr.sa_attr.lvb_size + 1; } /* stop cl_io_init() loop */ RETURN(1); -- 1.8.3.1