[lustre-devel] [PATCH 01/23] lustre: lov: one more fix to write_intent end for trunc

James Simmons jsimmons at infradead.org
Tue Aug 11 05:19:57 PDT 2020


From: Bobi Jam <bobijam at whamcloud.com>

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: 782b737b76c1 ("lustre: lov: Correct write_intent end for trunc")
WC-bug-id: https://jira.whamcloud.com/browse/LU-12586
Lustre-commit: ecf9e229cf59d ("LU-12586 lov: one more fix to write_intent end for trunc")
Signed-off-by: Bobi Jam <bobijam at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/38412
Reviewed-by: Wang Shilong <wshilong at whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli at ddn.com>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/lov/lov_io.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/lustre/lov/lov_io.c b/fs/lustre/lov/lov_io.c
index 99b68d8..af79d20 100644
--- a/fs/lustre/lov/lov_io.c
+++ b/fs/lustre/lov/lov_io.c
@@ -363,11 +363,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



More information about the lustre-devel mailing list