From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 709F31FF2C6 for ; Tue, 9 Jul 2024 13:50:59 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1ECBD1EB5B; Tue, 9 Jul 2024 13:51:20 +0200 (CEST) From: Maximiliano Sandoval To: pve-devel@lists.proxmox.com Date: Tue, 9 Jul 2024 13:51:15 +0200 Message-Id: <20240709115116.333708-1-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.171 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URI_NOVOWEL 0.5 URI hostname has long non-vowel sequence Subject: [pve-devel] [PATCH storage 1/2] fix #3873: btrfs: check for correct subvolume taking snapshot 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Suppose we are doing a snapshot of disk 0 for VM 100. The dir_glob_foreach runs over $path=/subvolume/images/100, lists all snapshot names and appends their names to the path of the disk, e.g. /subvolume/images/vm-100-disk-0@SNAP_NAME, but the original directory $path might contain a second disk `vm-100-disk-1` which is also listed by the dir_glib_foreach. The patch skips images which reference other disks. Signed-off-by: Maximiliano Sandoval --- src/PVE/Storage/BTRFSPlugin.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm index 42815cb..dc0420d 100644 --- a/src/PVE/Storage/BTRFSPlugin.pm +++ b/src/PVE/Storage/BTRFSPlugin.pm @@ -767,6 +767,9 @@ sub volume_export { push @$cmd, (map { "$path\@$_" } ($with_snapshots // [])->@*), $path; } else { dir_glob_foreach(dirname($path), $BTRFS_VOL_REGEX, sub { + if (index($path, $_[1]) < 0) { + return + } push @$cmd, "$path\@$_[2]" if !(defined($snapshot) && $_[2] eq $snapshot); }); } -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel