1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-22 15:57:15 +00:00

Merge pull request #6055 from ThomasWaldmann/fix-hl-preload-master

fix hardlinkable file type check, fixes #6037
This commit is contained in:
TW 2021-11-16 15:25:59 +01:00 committed by GitHub
commit ef6a65214e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -288,19 +288,21 @@ def _preload(chunks):
# corresponding hardlink slave is selected (== is extracted).
# due to a side effect of the filter() call, we now have hardlink_masters dict populated.
for item in items:
if 'chunks' in item: # regular file, maybe a hardlink master
_preload(item.chunks)
# if this is a hardlink master, remember that we already preloaded it:
if 'source' not in item and hardlinkable(item.mode) and item.get('hardlink_master', True):
masters_preloaded.add(item.path)
elif 'source' in item and hardlinkable(item.mode): # hardlink slave
source = item.source
if source not in masters_preloaded:
# we only need to preload *once* (for the 1st selected slave)
chunks, _ = hardlink_masters[source]
if chunks is not None:
_preload(chunks)
masters_preloaded.add(source)
if hardlinkable(item.mode):
source = item.get('source')
if source is None: # maybe a hardlink master
if 'chunks' in item:
_preload(item.chunks)
# if this is a hl master, remember that we already preloaded all chunks of it (if any):
if item.get('hardlink_master', True):
masters_preloaded.add(item.path)
else: # hardlink slave
if source not in masters_preloaded:
# we only need to preload *once* (for the 1st selected slave)
chunks, _ = hardlink_masters[source]
if chunks is not None:
_preload(chunks)
masters_preloaded.add(source)
else:
# easy: we do not have a filter, thus all items are selected, thus we need to preload all chunks.
for item in items: