]> git.proxmox.com Git - pmg-api.git/commit
backup: pbs: prevent race in concurrent backups
authorStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 1 Mar 2021 14:12:18 +0000 (15:12 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 5 Mar 2021 21:41:38 +0000 (22:41 +0100)
commita528c44128c72e79613d750c6b4b9559ab10af28
treea845a0597d0cb1dd87440c8febb6b3845e8919d2
parentb2033d4bd7f7e9e6ae551076da8314f278d1f115
backup: pbs: prevent race in concurrent backups

If two pbs backup-creation calls happen simultaneously, it is possible
that the first removes the backup dir before the other is done
creating or sending it to the pbs remote.

This patch takes the same route as non-PBS backups - creating a unique
tempdir indexed by remote, PID and current time.

the tmp-dir now also needs to be removed in case of error while
backing up. (before the next invocation would have wiped it).

Noticed while having 2 schedules to different PBS instances with the
same interval and w/o random delay.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PMG/API2/PBS/Job.pm