From 6145e0f9780ddba00b34f1fd9f0ec8e7093627d3 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Sat, 16 Dec 2023 17:40:16 -0500 Subject: [PATCH] EX-8826 ofd: set compressed file size for fake writes When using the fake writes fail_loc, file size setting is done at the ofd layer, since the osd layer isn't used. So we must also handle the compressed file size for this case. This fixes sanity test 399a with compression. Signed-off-by: Patrick Farrell Change-Id: Icda612405908166d043e1e568d0d8bd9cd0c5156 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53483 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko --- lustre/ofd/ofd_io.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index 157d2b0..ad62c8b 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -1677,6 +1677,8 @@ ofd_commitrw_write(const struct lu_env *env, struct obd_export *exp, if (OBD_FAIL_CHECK_QUIET(OBD_FAIL_OST_FAKE_RW)) { struct niobuf_local *last = &lnb[niocount - 1]; __u64 file_size = last->lnb_file_offset + last->lnb_len; + bool compressed = last->lnb_flags & OBD_BRW_COMPRESSED; + __u64 user_size = oa->o_size; __u64 valid = la->la_valid; la->la_valid = LA_SIZE; @@ -1687,6 +1689,11 @@ ofd_commitrw_write(const struct lu_env *env, struct obd_export *exp, if (file_size < la->la_size) file_size = la->la_size; + /* compressed files can have holes at the end of the object due + * to compression, so we must use the user size + */ + if (compressed && user_size > file_size) + file_size = user_size; /* dirty inode by setting file size */ la->la_valid = valid | LA_SIZE; -- 1.8.3.1