Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 35dd1b5

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 52fc948 commit 35dd1b5

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
@@ -2654,18 +2654,15 @@ pre_sync_fname(const char *fname, bool isdir, int elevel)
26542654
{
26552655
if (errno == EACCES || (isdir && errno == EISDIR))
26562656
return;
2657-
2658-
#ifdef ETXTBSY
2659-
if (errno == ETXTBSY)
2660-
return;
2661-
#endif
2662-
26632657
ereport(elevel,
26642658
(errcode_for_file_access(),
26652659
errmsg("could not open file \"%s\": %m", fname)));
26662660
return;
26672661
}
26682662

2663+
/*
2664+
* We ignore errors from pg_flush_data() because this is only a hint.
2665+
*/
26692666
(void) pg_flush_data(fd, 0, 0);
26702667

26712668
(void) CloseTransientFile(fd);
@@ -2709,12 +2706,6 @@ fsync_fname_ext(const char *fname, bool isdir, int elevel)
27092706
{
27102707
if (errno == EACCES || (isdir && errno == EISDIR))
27112708
return;
2712-
2713-
#ifdef ETXTBSY
2714-
if (errno == ETXTBSY)
2715-
return;
2716-
#endif
2717-
27182709
ereport(elevel,
27192710
(errcode_for_file_access(),
27202711
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
@@ -625,12 +625,6 @@ pre_sync_fname(const char *fname, bool isdir)
625625
{
626626
if (errno == EACCES || (isdir && errno == EISDIR))
627627
return;
628-
629-
#ifdef ETXTBSY
630-
if (errno == ETXTBSY)
631-
return;
632-
#endif
633-
634628
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
635629
progname, fname, strerror(errno));
636630
return;
@@ -690,12 +684,6 @@ fsync_fname_ext(const char *fname, bool isdir)
690684
{
691685
if (errno == EACCES || (isdir && errno == EISDIR))
692686
return;
693-
694-
#ifdef ETXTBSY
695-
if (errno == ETXTBSY)
696-
return;
697-
#endif
698-
699687
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
700688
progname, fname, strerror(errno));
701689
return;

0 commit comments

Comments
 (0)