]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage.pm
prune mark: correctly keep track of already included backups
[pve-storage.git] / PVE / Storage.pm
index aded60e3747ae56c3c8eab6752568ea65ecb4ecc..c1a21b43d96adfa7e587c87b2b3828fa57df1d85 100755 (executable)
@@ -1646,13 +1646,14 @@ my $prune_mark = sub {
     foreach my $prune_entry (@{$prune_entries}) {
        my $mark = $prune_entry->{mark};
        my $id = $id_func->($prune_entry->{ctime});
+       $already_included->{$id} = 1 if defined($mark) && $mark eq 'keep';
+    }
 
-       next if $already_included->{$id};
+    foreach my $prune_entry (@{$prune_entries}) {
+       my $mark = $prune_entry->{mark};
+       my $id = $id_func->($prune_entry->{ctime});
 
-       if (defined($mark)) {
-           $already_included->{$id} = 1 if $mark eq 'keep';
-           next;
-       }
+       next if defined($mark) || $already_included->{$id};
 
        if (!$newly_included->{$id}) {
            last if scalar(keys %{$newly_included}) >= $keep_count;