Skip to content

Commit 53df05c

Browse files
committed
Revert "Do not crash if filesystem can't fsync"
This reverts commit d42e63d.
1 parent 4188247 commit 53df05c

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

util/env_posix.cc

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class PosixWritableFile final : public WritableFile {
325325
return status;
326326
}
327327

328-
return SyncFd(fd_, filename_, false);
328+
return SyncFd(fd_, filename_);
329329
}
330330

331331
private:
@@ -360,7 +360,7 @@ class PosixWritableFile final : public WritableFile {
360360
if (fd < 0) {
361361
status = PosixError(dirname_, errno);
362362
} else {
363-
status = SyncFd(fd, dirname_, true);
363+
status = SyncFd(fd, dirname_);
364364
::close(fd);
365365
}
366366
return status;
@@ -372,7 +372,7 @@ class PosixWritableFile final : public WritableFile {
372372
//
373373
// The path argument is only used to populate the description string in the
374374
// returned Status if an error occurs.
375-
static Status SyncFd(int fd, const std::string& fd_path, bool syncing_dir) {
375+
static Status SyncFd(int fd, const std::string& fd_path) {
376376
#if HAVE_FULLFSYNC
377377
// On macOS and iOS, fsync() doesn't guarantee durability past power
378378
// failures. fcntl(F_FULLFSYNC) is required for that purpose. Some
@@ -392,11 +392,6 @@ class PosixWritableFile final : public WritableFile {
392392
if (sync_success) {
393393
return Status::OK();
394394
}
395-
// Do not crash if filesystem can't fsync directories
396-
// (see https://github.com/bitcoin/bitcoin/pull/10000)
397-
if (syncing_dir && errno == EINVAL) {
398-
return Status::OK();
399-
}
400395
return PosixError(fd_path, errno);
401396
}
402397

0 commit comments

Comments
 (0)