1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 01:37:20 +00:00

files cache: update inode number, fixes #2226

This commit is contained in:
Thomas Waldmann 2017-02-27 15:30:55 +01:00
parent 1a67b82726
commit 0721cb1ede

View file

@ -575,7 +575,15 @@ def file_known_and_unchanged(self, path_hash, st, ignore_inode=False):
entry = FileCacheEntry(*msgpack.unpackb(entry)) entry = FileCacheEntry(*msgpack.unpackb(entry))
if (entry.size == st.st_size and entry.mtime == st.st_mtime_ns and if (entry.size == st.st_size and entry.mtime == st.st_mtime_ns and
(ignore_inode or entry.inode == st.st_ino)): (ignore_inode or entry.inode == st.st_ino)):
self.files[path_hash] = msgpack.packb(entry._replace(age=0)) # we ignored the inode number in the comparison above or it is still same.
# if it is still the same, replacing it in the tuple doesn't change it.
# if we ignored it, a reason for doing that is that files were moved to a new
# disk / new fs (so a one-time change of inode number is expected) and we wanted
# to avoid everything getting chunked again. to be able to re-enable the inode
# number comparison in a future backup run (and avoid chunking everything
# again at that time), we need to update the inode number in the cache with what
# we see in the filesystem.
self.files[path_hash] = msgpack.packb(entry._replace(inode=st.st_ino, age=0))
return entry.chunk_ids return entry.chunk_ids
else: else:
return None return None