mirror of https://github.com/borgbackup/borg.git
ignore posix_fadvise errors in repository.py, work around #2095
note: we also ignore the call's return value in _chunker.c. both is harmless as the call not working does not cause incorrect function, just worse performance due to constant flooding of the cache (as if we would not issue the call).
This commit is contained in:
parent
5a39d5c4f8
commit
add38e8cde
|
@ -833,9 +833,19 @@ class LoggedIO:
|
||||||
fileno = fd.fileno()
|
fileno = fd.fileno()
|
||||||
os.fsync(fileno)
|
os.fsync(fileno)
|
||||||
if hasattr(os, 'posix_fadvise'): # only on UNIX
|
if hasattr(os, 'posix_fadvise'): # only on UNIX
|
||||||
# tell the OS that it does not need to cache what we just wrote,
|
try:
|
||||||
# avoids spoiling the cache for the OS and other processes.
|
# tell the OS that it does not need to cache what we just wrote,
|
||||||
os.posix_fadvise(fileno, 0, 0, os.POSIX_FADV_DONTNEED)
|
# avoids spoiling the cache for the OS and other processes.
|
||||||
|
os.posix_fadvise(fileno, 0, 0, os.POSIX_FADV_DONTNEED)
|
||||||
|
except OSError:
|
||||||
|
# usually, posix_fadvise can't fail for us, but there seem to
|
||||||
|
# be failures when running borg under docker on ARM, likely due
|
||||||
|
# to a bug outside of borg.
|
||||||
|
# also, there is a python wrapper bug, always giving errno = 0.
|
||||||
|
# https://github.com/borgbackup/borg/issues/2095
|
||||||
|
# as this call is not critical for correct function (just to
|
||||||
|
# optimize cache usage), we ignore these errors.
|
||||||
|
pass
|
||||||
finally:
|
finally:
|
||||||
fd.close()
|
fd.close()
|
||||||
if dirname:
|
if dirname:
|
||||||
|
|
Loading…
Reference in New Issue