git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 483520e)
Tolerate EINVAL when calling fsync() on a directory.
2019年2月24日 10:48:52 +0000 (23:48 +1300)
2019年2月24日 10:50:20 +0000 (23:50 +1300)
Previously, we tolerated EBADF as a way for the operating system to
indicate that it doesn't support fsync() on a directory. Tolerate
EINVAL too, for older versions of Linux CIFS.

Bug #15636. Back-patch all the way.

Reported-by: John Klann
Discussion: https://postgr.es/m/15636-d380890dafd78fc6@postgresql.org


diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index d46639d2edeeed9695a9a7efb39644bb503b0709..1ba0ddac107b27a13dccd786df90d54c964393d7 100644 (file)
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3379,7 +3379,7 @@ fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel)
* Some OSes don't allow us to fsync directories at all, so we can ignore
* those errors. Anything else needs to be logged.
*/
- if (returncode != 0 && !(isdir && errno == EBADF))
+ if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
{
int save_errno;
diff --git a/src/common/file_utils.c b/src/common/file_utils.c
index 4bcb9c1e0589091858f4a499de580ec3184550d0..c25713d0e50fa3f055c8c8f66c87855b57c03e9e 100644 (file)
--- a/src/common/file_utils.c
+++ b/src/common/file_utils.c
@@ -299,7 +299,7 @@ fsync_fname(const char *fname, bool isdir, const char *progname)
* Some OSes don't allow us to fsync directories at all, so we can ignore
* those errors. Anything else needs to be reported.
*/
- if (returncode != 0 && !(isdir && errno == EBADF))
+ if (returncode != 0 && !(isdir && (errno == EBADF || errno == EINVAL)))
{
fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
progname, fname, strerror(errno));
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /