diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 03788f61c2873b2c07577d115ff67e6fd4c756d3..90d06bee1816ae0545f1f4d95e4c2332872d39b4 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2477,18 +2477,15 @@ pre_sync_fname(const char *fname, bool isdir, int elevel)
 	{
 		if (errno == EACCES || (isdir && errno == EISDIR))
 			return;
-
-#ifdef ETXTBSY
-		if (errno == ETXTBSY)
-			return;
-#endif
-
 		ereport(elevel,
 				(errcode_for_file_access(),
 				 errmsg("could not open file \"%s\": %m", fname)));
 		return;
 	}
 
+	/*
+	 * We ignore errors from pg_flush_data() because this is only a hint.
+	 */
 	(void) pg_flush_data(fd, 0, 0);
 
 	(void) close(fd);
@@ -2532,12 +2529,6 @@ fsync_fname_ext(const char *fname, bool isdir, int elevel)
 	{
 		if (errno == EACCES || (isdir && errno == EISDIR))
 			return;
-
-#ifdef ETXTBSY
-		if (errno == ETXTBSY)
-			return;
-#endif
-
 		ereport(elevel,
 				(errcode_for_file_access(),
 				 errmsg("could not open file \"%s\": %m", fname)));