public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage 1/2] fix #3873: btrfs: check for correct subvolume taking snapshot
@ 2024-07-09 11:51 Maximiliano Sandoval
  2024-07-09 11:51 ` [pve-devel] [PATCH storage 2/2] btrfs: forcefully set image to readwrite Maximiliano Sandoval
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Maximiliano Sandoval @ 2024-07-09 11:51 UTC (permalink / raw)
  To: 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 <m.sandoval@proxmox.com>
---
 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-09-13 13:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-09 11:51 [pve-devel] [PATCH storage 1/2] fix #3873: btrfs: check for correct subvolume taking snapshot Maximiliano Sandoval
2024-07-09 11:51 ` [pve-devel] [PATCH storage 2/2] btrfs: forcefully set image to readwrite Maximiliano Sandoval
2024-08-19 11:27 ` [pve-devel] [PATCH storage 1/2] fix #3873: btrfs: check for correct subvolume taking snapshot Maximiliano Sandoval
2024-08-20 14:01 ` Hannes Laimer
2024-09-10 13:13 ` Fiona Ebner
2024-09-13 13:51   ` Maximiliano Sandoval
2024-09-13 13:43 ` Maximiliano Sandoval

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal