btrbk: fix mountinfo tree root detection

Set node as tree root if mount_id == parent_id. For some reasons this
is never the case on my (mostly gentoo) systems.

Regression from: eb69bc88 btrbk: refactor mountinfo
pull/446/head
Axel Burri 2022-02-06 11:55:04 +01:00
parent ed8142ed9d
commit 0172e4a240
1 changed files with 2 additions and 1 deletions

3
btrbk
View File

@ -2958,7 +2958,8 @@ sub mountinfo_tree($)
my %id = map +( $_->{mount_id} => $_ ), @$mountinfo;
my $tree_root;
foreach my $node (@$mountinfo) {
if(my $parent = $id{$node->{parent_id}}) {
my $parent = $id{$node->{parent_id}};
if($parent && ($node->{mount_id} != $node->{parent_id})) {
$node->{PARENT} = $parent;
push @{$parent->{SUBTREE}}, $node;
} else {