* [pve-devel] [PATCH manager] partially fix #3056: namespace vzdump tmpdir with vmid
@ 2020-10-19 14:15 Dominik Csapak
2020-10-20 7:13 ` Fabian Grünbichler
2020-10-22 16:53 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2020-10-19 14:15 UTC (permalink / raw)
To: pve-devel
this fixes an issue where a rogue running backup would upload the vm
config of a later backup in a backup job
instead now that directory gets deleted and the config is not
available anymore
we cannot really keep those directories around until the end of the
backup job, since we temporarily save ct contents there, which could get
large very fast
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
PVE/VZDump.pm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 542228d6..cdcb658f 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -769,10 +769,11 @@ sub exec_backup_task {
$task->{vmtype} = $vmtype;
+ my $pid = $$;
if ($opts->{tmpdir}) {
- $task->{tmpdir} = "$opts->{tmpdir}/vzdumptmp$$";
+ $task->{tmpdir} = "$opts->{tmpdir}/vzdumptmp${pid}_$vmid/";
} elsif ($self->{opts}->{pbs}) {
- $task->{tmpdir} = "/var/tmp/vzdumptmp$$"; #fixme
+ $task->{tmpdir} = "/var/tmp/vzdumptmp${pid}_$vmid";
} else {
# dumpdir is posix? then use it as temporary dir
my $info = get_mount_info($opts->{dumpdir});
@@ -780,7 +781,7 @@ sub exec_backup_task {
grep ($_ eq $info->{fstype}, @posix_filesystems)) {
$task->{tmpdir} = "$opts->{dumpdir}/$basename.tmp";
} else {
- $task->{tmpdir} = "/var/tmp/vzdumptmp$$";
+ $task->{tmpdir} = "/var/tmp/vzdumptmp${pid}_$vmid";
debugmsg ('info', "filesystem type on dumpdir is '$info->{fstype}' -" .
"using $task->{tmpdir} for temporary files", $logfd);
}
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] [PATCH manager] partially fix #3056: namespace vzdump tmpdir with vmid
2020-10-19 14:15 [pve-devel] [PATCH manager] partially fix #3056: namespace vzdump tmpdir with vmid Dominik Csapak
@ 2020-10-20 7:13 ` Fabian Grünbichler
2020-10-22 16:53 ` [pve-devel] applied: " Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2020-10-20 7:13 UTC (permalink / raw)
To: Proxmox VE development discussion
On October 19, 2020 4:15 pm, Dominik Csapak wrote:
> this fixes an issue where a rogue running backup would upload the vm
> config of a later backup in a backup job
>
> instead now that directory gets deleted and the config is not
> available anymore
>
> we cannot really keep those directories around until the end of the
> backup job, since we temporarily save ct contents there, which could get
> large very fast
Wolfang made the suggestion yesterday that we could get Qemu to open it
directly after being passed the path via QMP, that way vzdump can delete
it but Qemu still has a reference to the old (correct) file. might be a
good additional followup even with this change?
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> PVE/VZDump.pm | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
> index 542228d6..cdcb658f 100644
> --- a/PVE/VZDump.pm
> +++ b/PVE/VZDump.pm
> @@ -769,10 +769,11 @@ sub exec_backup_task {
>
> $task->{vmtype} = $vmtype;
>
> + my $pid = $$;
> if ($opts->{tmpdir}) {
> - $task->{tmpdir} = "$opts->{tmpdir}/vzdumptmp$$";
> + $task->{tmpdir} = "$opts->{tmpdir}/vzdumptmp${pid}_$vmid/";
> } elsif ($self->{opts}->{pbs}) {
> - $task->{tmpdir} = "/var/tmp/vzdumptmp$$"; #fixme
> + $task->{tmpdir} = "/var/tmp/vzdumptmp${pid}_$vmid";
> } else {
> # dumpdir is posix? then use it as temporary dir
> my $info = get_mount_info($opts->{dumpdir});
> @@ -780,7 +781,7 @@ sub exec_backup_task {
> grep ($_ eq $info->{fstype}, @posix_filesystems)) {
> $task->{tmpdir} = "$opts->{dumpdir}/$basename.tmp";
> } else {
> - $task->{tmpdir} = "/var/tmp/vzdumptmp$$";
> + $task->{tmpdir} = "/var/tmp/vzdumptmp${pid}_$vmid";
> debugmsg ('info', "filesystem type on dumpdir is '$info->{fstype}' -" .
> "using $task->{tmpdir} for temporary files", $logfd);
> }
> --
> 2.20.1
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied: [PATCH manager] partially fix #3056: namespace vzdump tmpdir with vmid
2020-10-19 14:15 [pve-devel] [PATCH manager] partially fix #3056: namespace vzdump tmpdir with vmid Dominik Csapak
2020-10-20 7:13 ` Fabian Grünbichler
@ 2020-10-22 16:53 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2020-10-22 16:53 UTC (permalink / raw)
To: Proxmox VE development discussion, Dominik Csapak
On 19.10.20 16:15, Dominik Csapak wrote:
> this fixes an issue where a rogue running backup would upload the vm
> config of a later backup in a backup job
>
> instead now that directory gets deleted and the config is not
> available anymore
>
> we cannot really keep those directories around until the end of the
> backup job, since we temporarily save ct contents there, which could get
> large very fast
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> PVE/VZDump.pm | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-22 16:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 14:15 [pve-devel] [PATCH manager] partially fix #3056: namespace vzdump tmpdir with vmid Dominik Csapak
2020-10-20 7:13 ` Fabian Grünbichler
2020-10-22 16:53 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox