public inbox for [email protected]
help / color / mirror / Atom feed[PATCH] Fix EINTR retry condition in pg_flush_data sync_file_range path.
2+ messages / 2 participants
[nested] [flat]
* [PATCH] Fix EINTR retry condition in pg_flush_data sync_file_range path.
@ 2026-04-29 15:18 DaeMyung Kang <[email protected]>
2026-04-30 02:48 ` Re: [PATCH] Fix EINTR retry condition in pg_flush_data sync_file_range path. Michael Paquier <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: DaeMyung Kang @ 2026-04-29 15:18 UTC (permalink / raw)
To: [email protected]; +Cc: DaeMyung Kang <[email protected]>
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(-)
Attachments:
[text/x-patch] 0001-Fix-EINTR-retry-condition-in-pg_flush_data-sync_file.patch (308B, 2-0001-Fix-EINTR-retry-condition-in-pg_flush_data-sync_file.patch)
download | inline diff:
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index a8be066afe0..817855e2720 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -563,7 +563,7 @@ retry:
{
int elevel;
- if (rc == EINTR)
+ if (errno == EINTR)
goto retry;
/*
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [PATCH] Fix EINTR retry condition in pg_flush_data sync_file_range path.
2026-04-29 15:18 [PATCH] Fix EINTR retry condition in pg_flush_data sync_file_range path. DaeMyung Kang <[email protected]>
@ 2026-04-30 02:48 ` Michael Paquier <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Michael Paquier @ 2026-04-30 02:48 UTC (permalink / raw)
To: DaeMyung Kang <[email protected]>; +Cc: [email protected]
On Thu, Apr 30, 2026 at 12:18:11AM +0900, DaeMyung Kang wrote:
> 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.
Ohh, nice catch. This happens to be wrong since 0d369ac65004.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, 2-signature.asc)
download
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-04-30 02:48 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-29 15:18 [PATCH] Fix EINTR retry condition in pg_flush_data sync_file_range path. DaeMyung Kang <[email protected]>
2026-04-30 02:48 ` Michael Paquier <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox