From 7b818f8d6438db02ea9035b2095ac04a402a0e01 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Wed, 21 May 2025 16:33:52 +0300 Subject: [PATCH] work around copy_to_user failure on reads --- pgxn/neon/file_cache.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pgxn/neon/file_cache.c b/pgxn/neon/file_cache.c index 183149b037..0c1fb30f04 100644 --- a/pgxn/neon/file_cache.c +++ b/pgxn/neon/file_cache.c @@ -1451,11 +1451,15 @@ pread_with_ioctl(void *buffer, uint64 blkno) errno = 0; - elog(LOG, "calling ioctl read for blk %lu with buffer=%p (shared_buffers is at %p-%p)", + elog(DEBUG1, "calling ioctl read for blk %lu with buffer=%p (shared_buffers is at %p-%p)", blkno, buffer, BufferBlocks, BufferBlocks + BLCKSZ * NBuffers); + /* FIXME: touch the pages, so that copy_to_user doesn't fail in the kernel module */ + ((char *) buffer)[0] = 'x'; + ((char *) buffer)[4096] = 'x'; + rc = ioctl(lfc_desc, NEON_IOCTL_READ, &args); if (rc >= 0) lfc_ctl->kernel_module_read_hits++; @@ -1480,7 +1484,7 @@ pwrite_with_ioctl(const void *buffer, uint64 blkno) }; int rc; - elog(LOG, "calling ioctl write for blk %lu with buffer=%p (shared_buffers is at %p-%p)", + elog(DEBUG1, "calling ioctl write for blk %lu with buffer=%p (shared_buffers is at %p-%p)", blkno, buffer, BufferBlocks,