From 2a1a42e8244611518be3e6b767d5a419dddfb2cc Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 20 Nov 2022 14:37:12 +0100 Subject: [PATCH] btrbk: related_nodes: add fatal option --- btrbk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/btrbk b/btrbk index 96c8be1..a66ff65 100755 --- a/btrbk +++ b/btrbk @@ -3518,9 +3518,11 @@ sub _related_nodes($;@) $distance++; } if($distance >= $abort_distance) { - my $logmsg = "Parent UUID chain exceeds depth=$abort_distance, ignoring related parents of uuid=$uuid for: " . _fs_path($snode); + my $logmsg = "Parent UUID chain exceeds depth=$abort_distance" . + ($opts{fatal} ? " for: " : ", ignoring related parents of uuid=$uuid for: ") . _fs_path($snode); DEBUG $logmsg; WARN_ONCE $logmsg unless($opts{nowarn}); + return undef if($opts{fatal}); } TRACE "related_nodes: d=$distance uuid=$uuid : top of parent chain" if($do_trace); @@ -3533,9 +3535,11 @@ sub _related_nodes($;@) my $children = $parent_uuid_hash->{$uuid}; if($children) { if($distance >= $abort_distance) { - my $logmsg = "Parent/child relations exceed depth=$abort_distance, ignoring related children of uuid=$uuid for: " . _fs_path($snode); + my $logmsg = "Parent/child relations exceed depth=$abort_distance" . + ($opts{fatal} ? " for: " : ", ignoring related children of uuid=$uuid for: ") . _fs_path($snode); DEBUG $logmsg; WARN_ONCE $logmsg unless($opts{nowarn}); + return undef if($opts{fatal}); } else { push @nn, { MARK_UUID => $uuid, MARK_DISTANCE => ($distance + 1) }, @$children; }