pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix error handling in pg_flush_data() and FilePrefetch()
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix error handling in pg_flush_data() and FilePrefetch()
@ 2026-10-31 09:48 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 7+ messages in thread

From: Heikki Linnakangas @ 2026-10-31 09:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling in pg_flush_data() and FilePrefetch()

posix_fadvise() returns an error code directly instead of setting
errno. However, pg_flush_data() uses %m and errcode_for_file_access()
to report errors without setting errno, potentially reporting an
unrelated error. Fix this by assigning the returned error code to
errno before reporting the error.

FilePrefetch() is documented to return an errno error code on failure,
but it returns -1 when FileAccess() fails. Fix this by returning errno
instead.

The first bug one only affects a warning, and the second doesn't have
any effect because the only existing caller ignores the return value.
So these are pretty harmless bugs, but let's be tidy.

Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/F1916C7A-F152-4AF3-87A9-40492D8B3670@gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/61a372b795ddec08c15518096fe1f3e9e9973096

Modified Files
--------------
src/backend/storage/file/fd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling in pg_flush_data() and FilePrefetch()
@ 2026-10-31 09:48 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 7+ messages in thread

From: Heikki Linnakangas @ 2026-10-31 09:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling in pg_flush_data() and FilePrefetch()

posix_fadvise() returns an error code directly instead of setting
errno. However, pg_flush_data() uses %m and errcode_for_file_access()
to report errors without setting errno, potentially reporting an
unrelated error. Fix this by assigning the returned error code to
errno before reporting the error.

FilePrefetch() is documented to return an errno error code on failure,
but it returns -1 when FileAccess() fails. Fix this by returning errno
instead.

The first bug one only affects a warning, and the second doesn't have
any effect because the only existing caller ignores the return value.
So these are pretty harmless bugs, but let's be tidy.

Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/F1916C7A-F152-4AF3-87A9-40492D8B3670@gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d50c656a8e344f6582a8bfcb84254b9e8a621e9e

Modified Files
--------------
src/backend/storage/file/fd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling in pg_flush_data() and FilePrefetch()
@ 2026-10-31 09:48 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 7+ messages in thread

From: Heikki Linnakangas @ 2026-10-31 09:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling in pg_flush_data() and FilePrefetch()

posix_fadvise() returns an error code directly instead of setting
errno. However, pg_flush_data() uses %m and errcode_for_file_access()
to report errors without setting errno, potentially reporting an
unrelated error. Fix this by assigning the returned error code to
errno before reporting the error.

FilePrefetch() is documented to return an errno error code on failure,
but it returns -1 when FileAccess() fails. Fix this by returning errno
instead.

The first bug one only affects a warning, and the second doesn't have
any effect because the only existing caller ignores the return value.
So these are pretty harmless bugs, but let's be tidy.

Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/F1916C7A-F152-4AF3-87A9-40492D8B3670@gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1cdfea37c268d41b47e1cf968103cb9866feec4d

Modified Files
--------------
src/backend/storage/file/fd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling in pg_flush_data() and FilePrefetch()
@ 2026-10-31 09:48 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 7+ messages in thread

From: Heikki Linnakangas @ 2026-10-31 09:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling in pg_flush_data() and FilePrefetch()

posix_fadvise() returns an error code directly instead of setting
errno. However, pg_flush_data() uses %m and errcode_for_file_access()
to report errors without setting errno, potentially reporting an
unrelated error. Fix this by assigning the returned error code to
errno before reporting the error.

FilePrefetch() is documented to return an errno error code on failure,
but it returns -1 when FileAccess() fails. Fix this by returning errno
instead.

The first bug one only affects a warning, and the second doesn't have
any effect because the only existing caller ignores the return value.
So these are pretty harmless bugs, but let's be tidy.

Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/F1916C7A-F152-4AF3-87A9-40492D8B3670@gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ce2797dca4f81bad7e4b838761bf717ceaaa584c

Modified Files
--------------
src/backend/storage/file/fd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling in pg_flush_data() and FilePrefetch()
@ 2026-10-31 09:48 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 7+ messages in thread

From: Heikki Linnakangas @ 2026-10-31 09:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling in pg_flush_data() and FilePrefetch()

posix_fadvise() returns an error code directly instead of setting
errno. However, pg_flush_data() uses %m and errcode_for_file_access()
to report errors without setting errno, potentially reporting an
unrelated error. Fix this by assigning the returned error code to
errno before reporting the error.

FilePrefetch() is documented to return an errno error code on failure,
but it returns -1 when FileAccess() fails. Fix this by returning errno
instead.

The first bug one only affects a warning, and the second doesn't have
any effect because the only existing caller ignores the return value.
So these are pretty harmless bugs, but let's be tidy.

Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/F1916C7A-F152-4AF3-87A9-40492D8B3670@gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f5e651d617c2367fd7d99924eefcc8dbb8b4beed

Modified Files
--------------
src/backend/storage/file/fd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling in pg_flush_data() and FilePrefetch()
@ 2026-10-31 09:48 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 7+ messages in thread

From: Heikki Linnakangas @ 2026-10-31 09:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling in pg_flush_data() and FilePrefetch()

posix_fadvise() returns an error code directly instead of setting
errno. However, pg_flush_data() uses %m and errcode_for_file_access()
to report errors without setting errno, potentially reporting an
unrelated error. Fix this by assigning the returned error code to
errno before reporting the error.

FilePrefetch() is documented to return an errno error code on failure,
but it returns -1 when FileAccess() fails. Fix this by returning errno
instead.

The first bug one only affects a warning, and the second doesn't have
any effect because the only existing caller ignores the return value.
So these are pretty harmless bugs, but let's be tidy.

Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/F1916C7A-F152-4AF3-87A9-40492D8B3670@gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a1d165d63cc8f3574882e75f8a0924544dcbe7ed

Modified Files
--------------
src/backend/storage/file/fd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling in pg_flush_data() and FilePrefetch()
@ 2026-10-31 09:48 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 7+ messages in thread

From: Heikki Linnakangas @ 2026-10-31 09:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling in pg_flush_data() and FilePrefetch()

posix_fadvise() returns an error code directly instead of setting
errno. However, pg_flush_data() uses %m and errcode_for_file_access()
to report errors without setting errno, potentially reporting an
unrelated error. Fix this by assigning the returned error code to
errno before reporting the error.

FilePrefetch() is documented to return an errno error code on failure,
but it returns -1 when FileAccess() fails. Fix this by returning errno
instead.

The first bug one only affects a warning, and the second doesn't have
any effect because the only existing caller ignores the return value.
So these are pretty harmless bugs, but let's be tidy.

Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/F1916C7A-F152-4AF3-87A9-40492D8B3670@gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9b24be3d94154856e019bb6ebdd8645f38bb2a68

Modified Files
--------------
src/backend/storage/file/fd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-10-31 09:48 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31 09:48 pgsql: Fix error handling in pg_flush_data() and FilePrefetch() Heikki Linnakangas <heikki.linnakangas@iki.fi>
2026-10-31 09:48 pgsql: Fix error handling in pg_flush_data() and FilePrefetch() Heikki Linnakangas <heikki.linnakangas@iki.fi>
2026-10-31 09:48 pgsql: Fix error handling in pg_flush_data() and FilePrefetch() Heikki Linnakangas <heikki.linnakangas@iki.fi>
2026-10-31 09:48 pgsql: Fix error handling in pg_flush_data() and FilePrefetch() Heikki Linnakangas <heikki.linnakangas@iki.fi>
2026-10-31 09:48 pgsql: Fix error handling in pg_flush_data() and FilePrefetch() Heikki Linnakangas <heikki.linnakangas@iki.fi>
2026-10-31 09:48 pgsql: Fix error handling in pg_flush_data() and FilePrefetch() Heikki Linnakangas <heikki.linnakangas@iki.fi>
2026-10-31 09:48 pgsql: Fix error handling in pg_flush_data() and FilePrefetch() Heikki Linnakangas <heikki.linnakangas@iki.fi>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox