From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 41AAE7114E for ; Wed, 8 Sep 2021 12:05:16 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2BE0A24654 for ; Wed, 8 Sep 2021 12:04:46 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id CB38D24649 for ; Wed, 8 Sep 2021 12:04:42 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 98361433CF for ; Wed, 8 Sep 2021 12:04:36 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Wed, 8 Sep 2021 12:04:27 +0200 Message-Id: <20210908100427.3166320-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.422 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [RFC container] fix #3606: drop --inplace from suspend backups X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 10:05:16 -0000 for bullseye-based systems, the 'fs.protected_regular'[0] sysctl is set to '2' by default[1] (as opposed to the old value of '0'). this breaks rsync's `--inplace` mode for such protected files, since opening them with O_CREAT is not even possible for the root user anymore. one example in the wild are debian (-based) containers using PHP, where the session dir '/var/lib/php/sessions' is sticky, world-writable, owned by root and contains sessions files usually owned by www-data. if any of these session files are modified between the first and second rsync run, the second run and thus the backup will fail. the downside of this change is that containers with large files that are updated between the first and second run will now see more (temp) space usage - but suspend mode is not space efficient anyway and such setups should consider switching to snapshot mode anyway. additionaly, this commit drops the now no longer needed $first parameter previously used to decide between different parameters for first and second rsync run. 0: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=30aba6656f61ed44cba445a3c0d38b296fa9e8f5 1: https://salsa.debian.org/debian/procps/-/commit/299f4a1a10810e2995e666374b880b543af8e8e4 Signed-off-by: Fabian Grünbichler --- RFC in case anybody has a better solution other than setting the sysctl to 0 again ;) src/PVE/VZDump/LXC.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm index b7f7463..19b5c16 100644 --- a/src/PVE/VZDump/LXC.pm +++ b/src/PVE/VZDump/LXC.pm @@ -20,7 +20,7 @@ use base qw (PVE::VZDump::Plugin); my $default_mount_point = "/mnt/vzsnap0"; my $rsync_vm = sub { - my ($self, $task, $to, $text, $first) = @_; + my ($self, $task, $to, $text) = @_; my $disks = $task->{disks}; my $from = $disks->[0]->{dir}; @@ -32,8 +32,7 @@ my $rsync_vm = sub { my $rsync = ['rsync', '--stats', '-h', @xattr, '--numeric-ids', '-aH', '--delete', '--no-whole-file', - ($first ? '--sparse' : '--inplace'), - '--one-file-system', '--relative']; + '--sparse', '--one-file-system', '--relative']; push @$rsync, "--bwlimit=$opts->{bwlimit}" if $opts->{bwlimit}; push @$rsync, map { "--exclude=$_" } @{$self->{vzdump}->{findexcl}}; push @$rsync, map { "--exclude=$_" } @{$task->{exclude_dirs}}; @@ -260,13 +259,13 @@ sub copy_data_phase1 { } } - $self->$rsync_vm($task, $task->{snapdir}, "first", 1); + $self->$rsync_vm($task, $task->{snapdir}, "first"); } sub copy_data_phase2 { my ($self, $task) = @_; - $self->$rsync_vm($task, $task->{snapdir}, "final", 0); + $self->$rsync_vm($task, $task->{snapdir}, "final"); } sub stop_vm { -- 2.30.2