fix #7183: vzdump: handle mount points with a relative path
The path of a mount point does not need to start with a slash, for example a mount point configured with mp0: tank:subvol-999-disk-0,mp=data,size=1G,backup=1 gets mounted at /data in the container when it starts. The backup code however builds its paths by appending the path of the mount point to the root directory, which only works with a leading slash. So such a mount point broke all three backup modes, as it ended up as '/mnt/vzsnap0/.data' instead of '/mnt/vzsnap0/./data' in snapshot and stop mode, and as '/proc/<PID>/root//.data' in suspend mode. Add the missing leading slash when collecting the mount points for the backup, so that all paths built from it are correct. This also anchors the exclude pattern of such a mount point if it is excluded from the backup, which otherwise matched every file or directory with the same name in suspend mode. Signed-off-by: Michal Fox <me@dualfroz.com>
This commit is contained in:
1 parent
73dec5df85
commit
94c60cf6cd
1 file changed
+4
@@ -157,6 +157,10 @@ sub prepare {
|
|||||||
|
|
||||||
next if !$volid || !$mount;
|
next if !$volid || !$mount;
|
||||||
|
|
||||||
|
# the path of a mount point is always relative to the root of the container, but it
|
||||||
|
# does not need to start with a slash, which all the paths built below rely on
|
||||||
|
$mount = $volume_config->{mp} = "/$mount" if $mount !~ m!^/!;
|
||||||
|
|
||||||
if (!$included) {
|
if (!$included) {
|
||||||
my $type = $volume_config->{type};
|
my $type = $volume_config->{type};
|
||||||
push @$exclude_dirs, $mount;
|
push @$exclude_dirs, $mount;
|
||||||
|
|||||||
Reference in new issue
Block a user