| From: | DaeMyung Kang <charsyam(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Cc: | DaeMyung Kang <charsyam(at)gmail(dot)com> |
| Subject: | [PATCH] Fix EINTR retry condition in pg_flush_data sync_file_range path. |
| Date: | 2026-04-29 15:18:11 |
| Message-ID: | 20260429151811.1810874-1-charsyam@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi, Hackers,
While auditing src/backend/storage/file, I spotted a small but
unambiguous bug in pg_flush_data()'s sync_file_range() retry path.
Details below in the commit message; the fix is a one-token change.
Thanks,
DaeMyung
---
The retry branch compared the syscall return value (rc) against EINTR,
but sync_file_range() returns -1 on error and reports the actual errno
out-of-band, so rc == EINTR was always false and the retry was dead
code. When sync_file_range() was actually interrupted by a signal,
control fell through to the warning/error path instead of retrying.
Compare errno instead, matching the convention already used elsewhere
in this file (e.g. the pg_pread/pg_pwrite EINTR retries) and a few
lines down for ENOSYS in this same block.
---
src/backend/storage/file/fd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-EINTR-retry-condition-in-pg_flush_data-sync_file.patch | text/x-patch | 308 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2026-04-29 15:32:44 | Making the ENUM operators LEAKPROOF |
| Previous Message | Ashutosh Bapat | 2026-04-29 14:09:41 | Re: [PATCH] Resolve unknown-type literals in GRAPH_TABLE COLUMNS |