aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2019-02-24 23:59:26 +1300
committerThomas Munro <tmunro@postgresql.org>2019-02-25 00:02:15 +1300
commit0ec89a0f6752d55efee4377928087b1865d7ac5e (patch)
tree1bc9cd3a3d8d147678a072bf14b139e620dddb21 /src
parent0fe3f6dd45c95f82bf6dcd98b4f9e029ce433ce0 (diff)
downloadpostgresql-0ec89a0f6752d55efee4377928087b1865d7ac5e.tar.gz
postgresql-0ec89a0f6752d55efee4377928087b1865d7ac5e.zip
Tolerate EINVAL when calling fsync() on a directory.
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
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/file/fd.c2
-rw-r--r--src/bin/initdb/initdb.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index c255583026f..ba7f3d96ae0 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2945,7 +2945,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/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 485a4024d50..a4d2184ff8c 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -688,7 +688,7 @@ fsync_fname_ext(const char *fname, bool isdir)
* 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));