Whamcloud - gitweb
LU-12586 lov: one more fix to write_intent end for trunc 12/38412/8
authorBobi Jam <bobijam@whamcloud.com>
Wed, 29 Apr 2020 09:14:04 +0000 (17:14 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 17 Jul 2020 19:29:09 +0000 (19:29 +0000)
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 <bobijam@whamcloud.com>
Change-Id: I40f14a48c53bfd1e6442e4414ee30f9eb159fc02
Reviewed-on: https://review.whamcloud.com/38412
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/lov/lov_io.c

index ef9e5bb..ce87872 100644 (file)
@@ -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);