btrbk: send/receive: only inject child if target creation was successful

pull/88/head
Axel Burri 2016-04-22 20:25:30 +02:00
parent 3ffa63daba
commit ecb2307b22
1 changed files with 17 additions and 15 deletions

4
btrbk
View File

@ -1784,7 +1784,7 @@ sub vinfo_inject_child($$$)
else { else {
my $node_subdir = defined($vinfo->{NODE_SUBDIR}) ? $vinfo->{NODE_SUBDIR} . '/' : ""; my $node_subdir = defined($vinfo->{NODE_SUBDIR}) ? $vinfo->{NODE_SUBDIR} . '/' : "";
$node = btr_tree_inject_node($vinfo->{node}, $detail, $rel_path); $node = btr_tree_inject_node($vinfo->{node}, $detail, $rel_path);
return undef unless(add_btrbk_filename_info($node)); #!!! fix in raw readin return undef unless(add_btrbk_filename_info($node));
} }
$vinfo_child->{node} = $node; $vinfo_child->{node} = $node;
$url_cache{$vinfo_child->{URL}} = $node; $url_cache{$vinfo_child->{URL}} = $node;
@ -2640,6 +2640,7 @@ sub macro_send_receive(@)
} }
# inject fake vinfo # inject fake vinfo
if($ret) {
vinfo_inject_child($target, $vol_received, { vinfo_inject_child($target, $vol_received, {
# NOTE: this is not necessarily the correct parent_uuid (on # NOTE: this is not necessarily the correct parent_uuid (on
# receive, btrfs-progs picks the uuid of the first (lowest id) # receive, btrfs-progs picks the uuid of the first (lowest id)
@ -2654,6 +2655,7 @@ sub macro_send_receive(@)
TARGET_TYPE => $target_type, TARGET_TYPE => $target_type,
FORCE_PRESERVE => 'preserve forced: created just now', FORCE_PRESERVE => 'preserve forced: created just now',
}); });
}
# add info to $config->{SUBVOL_RECEIVED} # add info to $config->{SUBVOL_RECEIVED}
$info{received_type} = $target_type || die; $info{received_type} = $target_type || die;