mirror of https://github.com/digint/btrbk
btrbk: send/receive: only inject child if target creation was successful
parent
3ffa63daba
commit
ecb2307b22
32
btrbk
32
btrbk
|
@ -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,20 +2640,22 @@ sub macro_send_receive(@)
|
||||||
}
|
}
|
||||||
|
|
||||||
# inject fake vinfo
|
# inject fake vinfo
|
||||||
vinfo_inject_child($target, $vol_received, {
|
if($ret) {
|
||||||
# NOTE: this is not necessarily the correct parent_uuid (on
|
vinfo_inject_child($target, $vol_received, {
|
||||||
# receive, btrfs-progs picks the uuid of the first (lowest id)
|
# NOTE: this is not necessarily the correct parent_uuid (on
|
||||||
# matching possible parent), whereas the target_parent is the
|
# receive, btrfs-progs picks the uuid of the first (lowest id)
|
||||||
# first from get_receive_targets().
|
# matching possible parent), whereas the target_parent is the
|
||||||
#
|
# first from get_receive_targets().
|
||||||
# NOTE: the parent_uuid of an injected receive target is not used
|
#
|
||||||
# anywhere in btrbk at the time of writing
|
# NOTE: the parent_uuid of an injected receive target is not used
|
||||||
parent_uuid => $parent ? $info{latest_common_target}->{node}{uuid} : '-',
|
# anywhere in btrbk at the time of writing
|
||||||
received_uuid => $source->{node}{received_uuid} eq '-' ? $source->{node}{uuid} : $source->{node}{received_uuid},
|
parent_uuid => $parent ? $info{latest_common_target}->{node}{uuid} : '-',
|
||||||
readonly => 1,
|
received_uuid => $source->{node}{received_uuid} eq '-' ? $source->{node}{uuid} : $source->{node}{received_uuid},
|
||||||
TARGET_TYPE => $target_type,
|
readonly => 1,
|
||||||
FORCE_PRESERVE => 'preserve forced: created just now',
|
TARGET_TYPE => $target_type,
|
||||||
});
|
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;
|
||||||
|
|
Loading…
Reference in New Issue