From 4c7f71a7331b7a94fbcc4cd7d56117514e89de7d Mon Sep 17 00:00:00 2001 From: Leonardo Alminana Date: Wed, 6 Sep 2023 16:24:54 +0200 Subject: [PATCH] lib: chunkio: fixed file mapping size This bug had already been fixed in upstream, the round operation causes the mapping size (and thus alloc size) to be larger than the file size which means there is a memory area that's not backed by the file which in some cases such as XFS causes data loss. Signed-off-by: Leonardo Alminana --- lib/chunkio/src/cio_file.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/chunkio/src/cio_file.c b/lib/chunkio/src/cio_file.c index 1cb9435d0ac..4099734a384 100644 --- a/lib/chunkio/src/cio_file.c +++ b/lib/chunkio/src/cio_file.c @@ -390,7 +390,6 @@ static int mmap_file(struct cio_ctx *ctx, struct cio_chunk *ch, size_t size) } /* Map the file */ - size = ROUND_UP(size, ctx->page_size); cf->map = mmap(0, size, oflags, MAP_SHARED, cf->fd, 0); if (cf->map == MAP_FAILED) { cio_errno();