*** src/backend/access/transam/slru.c.orig Fri Oct 14 22:59:37 2005 --- src/backend/access/transam/slru.c Fri Oct 28 17:41:07 2005 *************** *** 745,756 **** /* * We need to do I/O. Normal case is that we have to write it out, * but it's possible in the worst case to have selected a read-busy ! * page. In that case we use SimpleLruReadPage to wait for the read ! * to complete. */ if (shared->page_status[bestslot] == SLRU_PAGE_READ_IN_PROGRESS) ! (void) SimpleLruReadPage(ctl, shared->page_number[bestslot], ! InvalidTransactionId); else SimpleLruWritePage(ctl, bestslot, NULL); --- 745,760 ---- /* * We need to do I/O. Normal case is that we have to write it out, * but it's possible in the worst case to have selected a read-busy ! * page. In that case we just wait for someone else to complete ! * the I/O, which we can do by waiting for the per-buffer lock. */ if (shared->page_status[bestslot] == SLRU_PAGE_READ_IN_PROGRESS) ! { ! LWLockRelease(shared->ControlLock); ! LWLockAcquire(shared->buffer_locks[bestslot], LW_SHARED); ! LWLockRelease(shared->buffer_locks[bestslot]); ! LWLockAcquire(shared->ControlLock, LW_EXCLUSIVE); ! } else SimpleLruWritePage(ctl, bestslot, NULL); *************** *** 885,892 **** * the same logic as in SlruSelectLRUPage. */ if (shared->page_status[slotno] == SLRU_PAGE_READ_IN_PROGRESS) ! (void) SimpleLruReadPage(ctl, shared->page_number[slotno], ! InvalidTransactionId); else SimpleLruWritePage(ctl, slotno, NULL); goto restart; --- 889,900 ---- * the same logic as in SlruSelectLRUPage. */ if (shared->page_status[slotno] == SLRU_PAGE_READ_IN_PROGRESS) ! { ! LWLockRelease(shared->ControlLock); ! LWLockAcquire(shared->buffer_locks[slotno], LW_SHARED); ! LWLockRelease(shared->buffer_locks[slotno]); ! LWLockAcquire(shared->ControlLock, LW_EXCLUSIVE); ! } else SimpleLruWritePage(ctl, slotno, NULL); goto restart;