mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-31 18:27:22 +02:00
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
This commit is contained in:
parent
30dcb6270c
commit
4d67357dbf
@ -3538,7 +3538,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
|
* Some OSes don't allow us to fsync directories at all, so we can ignore
|
||||||
* those errors. Anything else needs to be logged.
|
* 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;
|
int save_errno;
|
||||||
|
|
||||||
|
@ -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
|
* Some OSes don't allow us to fsync directories at all, so we can ignore
|
||||||
* those errors. Anything else needs to be reported.
|
* 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"),
|
fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
|
||||||
progname, fname, strerror(errno));
|
progname, fname, strerror(errno));
|
||||||
|
Loading…
Reference in New Issue
Block a user