From 53df05cfef6048a65b11a5f703fce6d699a903bf Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Tue, 29 Apr 2025 10:09:38 +0200 Subject: [PATCH] Revert "Do not crash if filesystem can't fsync" This reverts commit d42e63d49d9df05b12cd00af4ffc5f2b3edf7e21. --- util/env_posix.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/util/env_posix.cc b/util/env_posix.cc index 86571059b..c91b68936 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -325,7 +325,7 @@ class PosixWritableFile final : public WritableFile { return status; } - return SyncFd(fd_, filename_, false); + return SyncFd(fd_, filename_); } private: @@ -360,7 +360,7 @@ class PosixWritableFile final : public WritableFile { if (fd < 0) { status = PosixError(dirname_, errno); } else { - status = SyncFd(fd, dirname_, true); + status = SyncFd(fd, dirname_); ::close(fd); } return status; @@ -372,7 +372,7 @@ class PosixWritableFile final : public WritableFile { // // The path argument is only used to populate the description string in the // returned Status if an error occurs. - static Status SyncFd(int fd, const std::string& fd_path, bool syncing_dir) { + static Status SyncFd(int fd, const std::string& fd_path) { #if HAVE_FULLFSYNC // On macOS and iOS, fsync() doesn't guarantee durability past power // failures. fcntl(F_FULLFSYNC) is required for that purpose. Some @@ -392,11 +392,6 @@ class PosixWritableFile final : public WritableFile { if (sync_success) { return Status::OK(); } - // Do not crash if filesystem can't fsync directories - // (see https://github.com/bitcoin/bitcoin/pull/10000) - if (syncing_dir && errno == EINVAL) { - return Status::OK(); - } return PosixError(fd_path, errno); }