pgsql-hackers
❮
[PATCH] Fix EINTR retry condition in pg_flush_data sync_file_range path.
- Jump to comment-1DaeMyung Kang<charsyam@gmail.com>Apr 29, 2026, 3:18 PM UTCHi, Hackers,
While auditing src/backend/storage/file, I spotted a small but
unambiguous bug in pgflushdata()'s syncfilerange() 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 syncfilerange() 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 syncfilerange() 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 pgpread/pgpwrite EINTR retries) and a few
lines down for ENOSYS in this same block.
---
1 file changed, 1 insertion(+), 1 deletion(-)src/backend/storage/file/fd.c | 2 +-- Jump to comment-1Michael Paquier<michael@paquier.xyz>Apr 30, 2026, 2:48 AM UTCOn Thu, Apr 30, 2026 at 12:18:11AM +0900, DaeMyung Kang wrote:
While auditing src/backend/storage/file, I spotted a small but
Ohh, nice catch. This happens to be wrong since 0d369ac65004.
unambiguous bug in pgflushdata()'s syncfilerange() retry path.
Details below in the commit message; the fix is a one-token change.
--
Michael