Skip to content

Commit 70a4519

Browse files
committed
Remove special cases for ETXTBSY from new fsync'ing logic.
The argument that this is a sufficiently-expected case to be silently ignored seems pretty thin. Andres had brought it up back when we were still considering that most fsync failures should be hard errors, and it probably would be legit not to fail hard for ETXTBSY --- but the same is true for EROFS and other cases, which is why we gave up on hard failures. ETXTBSY is surely not a normal case, so logging the failure seems fine from here.
1 parent dbde225 commit 70a4519

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

src/backend/storage/file/fd.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2647,18 +2647,15 @@ pre_sync_fname(const char *fname, bool isdir, int elevel)
26472647
{
26482648
if (errno == EACCES || (isdir && errno == EISDIR))
26492649
return;
2650-
2651-
#ifdef ETXTBSY
2652-
if (errno == ETXTBSY)
2653-
return;
2654-
#endif
2655-
26562650
ereport(elevel,
26572651
(errcode_for_file_access(),
26582652
errmsg("could not open file \"%s\": %m", fname)));
26592653
return;
26602654
}
26612655

2656+
/*
2657+
* We ignore errors from pg_flush_data() because this is only a hint.
2658+
*/
26622659
(void) pg_flush_data(fd, 0, 0);
26632660

26642661
(void) CloseTransientFile(fd);
@@ -2702,12 +2699,6 @@ fsync_fname_ext(const char *fname, bool isdir, int elevel)
27022699
{
27032700
if (errno == EACCES || (isdir && errno == EISDIR))
27042701
return;
2705-
2706-
#ifdef ETXTBSY
2707-
if (errno == ETXTBSY)
2708-
return;
2709-
#endif
2710-
27112702
ereport(elevel,
27122703
(errcode_for_file_access(),
27132704
errmsg("could not open file \"%s\": %m", fname)));

src/bin/initdb/initdb.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,6 @@ pre_sync_fname(const char *fname, bool isdir)
627627
{
628628
if (errno == EACCES || (isdir && errno == EISDIR))
629629
return;
630-
631-
#ifdef ETXTBSY
632-
if (errno == ETXTBSY)
633-
return;
634-
#endif
635-
636630
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
637631
progname, fname, strerror(errno));
638632
return;
@@ -692,12 +686,6 @@ fsync_fname_ext(const char *fname, bool isdir)
692686
{
693687
if (errno == EACCES || (isdir && errno == EISDIR))
694688
return;
695-
696-
#ifdef ETXTBSY
697-
if (errno == ETXTBSY)
698-
return;
699-
#endif
700-
701689
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
702690
progname, fname, strerror(errno));
703691
return;

0 commit comments

Comments
 (0)