From 7b5e3d6d407d4d11ce55b503c428c9ef547e2ee5 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 23 May 2025 12:11:01 +0200 Subject: [PATCH] Revert "work around copy_to_user failure on reads" Not necessary as of https://github.com/neondatabase-labs/neon-pagecache-kmod/commit/271b19bd3e2de7777770ac6b8b1b1c94bb33830b Reason why that commit fixes the issues is https://neondb.slack.com/archives/C08SXUSNFBP/p1747837985950309 > implemented a fix in the kernel module, no need for userspace to > pre-fault mmapped pages in; the reason for the EFAULT was that we were > holding a spinlock during copy_to_user, which disables preemption, which > in turn makes the page fault handler give up and cause copy_to_user to > fail; commit to be used is 271b19bd3e2de7777770ac6b8b1b1c94bb33830b > (edited) This reverts commit 7b818f8d6438db02ea9035b2095ac04a402a0e01. --- pgxn/neon/file_cache.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pgxn/neon/file_cache.c b/pgxn/neon/file_cache.c index 983e03bcbd..6b74a3e135 100644 --- a/pgxn/neon/file_cache.c +++ b/pgxn/neon/file_cache.c @@ -1451,15 +1451,11 @@ pread_with_ioctl(void *buffer, uint64 blkno) errno = 0; - elog(DEBUG1, "calling ioctl read for blk %lu with buffer=%p (shared_buffers is at %p-%p)", + elog(LOG, "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++; @@ -1484,7 +1480,7 @@ pwrite_with_ioctl(const void *buffer, uint64 blkno) }; int rc; - elog(DEBUG1, "calling ioctl write for blk %lu with buffer=%p (shared_buffers is at %p-%p)", + elog(LOG, "calling ioctl write for blk %lu with buffer=%p (shared_buffers is at %p-%p)", blkno, buffer, BufferBlocks,