Improve log message when fsync'ing directory fails (fixes 656)

This commit is contained in:
Unrud 2017-07-15 09:42:00 +02:00
parent 56c88b4c54
commit d3a90d16c3

View File

@ -688,11 +688,15 @@ class Collection(BaseCollection):
if not cls.configuration.getboolean("storage", "filesystem_fsync"):
return
if os.name == "posix":
try:
fd = os.open(path, 0)
try:
cls._fsync(fd)
finally:
os.close(fd)
except OSError as e:
raise RuntimeError("Fsync'ing directory %r failed: %s" %
(path, e)) from e
@classmethod
def _makedirs_synced(cls, filesystem_path):