From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 storage 5/5] btrfs: die early for broken subvolume resize
Date: Mon, 3 Mar 2025 10:24:45 +0100 [thread overview]
Message-ID: <20250303092445.13873-6-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250303092445.13873-1-f.ebner@proxmox.com>
In the BTRFS plugin, resize_volume() for a subovlume currently fails
with "failed to get btrfs subvolume ID from: ". This is because the
btrfs 'subvol show' command is invoked with '-q', so there is no
output.
As btrfs quotas are currently not implemented, die early with a clean
error instead and comment out the unused code for now.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Changes in v2:
* comment out dead code, squash patches
src/PVE/Storage/BTRFSPlugin.pm | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm
index b1f7912..ce21297 100644
--- a/src/PVE/Storage/BTRFSPlugin.pm
+++ b/src/PVE/Storage/BTRFSPlugin.pm
@@ -232,14 +232,15 @@ sub btrfs_cmd {
return $msg;
}
-sub btrfs_get_subvol_id {
- my ($class, $path) = @_;
- my $info = $class->btrfs_cmd(['subvolume', 'show', '--', $path]);
- if ($info !~ /^\s*(?:Object|Subvolume) ID:\s*(\d+)$/m) {
- die "failed to get btrfs subvolume ID from: $info\n";
- }
- return $1;
-}
+# NOTE: this function is currently boken, because btrfs_cmd uses '-q' so there will be no output.
+#sub btrfs_get_subvol_id {
+# my ($class, $path) = @_;
+# my $info = $class->btrfs_cmd(['subvolume', 'show', '--', $path]);
+# if ($info !~ /^\s*(?:Object|Subvolume) ID:\s*(\d+)$/m) {
+# die "failed to get btrfs subvolume ID from: $info\n";
+# }
+# return $1;
+#}
my sub chattr : prototype($$$) {
my ($fh, $mask, $xor) = @_;
@@ -497,10 +498,13 @@ sub volume_resize {
my $format = ($class->parse_volname($volname))[6];
if ($format eq 'subvol') {
- my $path = $class->filesystem_path($scfg, $volname);
- my $id = '0/' . $class->btrfs_get_subvol_id($path);
- $class->btrfs_cmd(['qgroup', 'limit', '--', "${size}k", "0/$id", $path]);
- return undef;
+ # NOTE: `btrfs send/recv` actually drops quota information so supporting subvolumes with
+ # quotas doesn't play nice with send/recv.
+ die "cannot resize subvolume - btrfs quotas are currently not supported\n";
+ # my $path = $class->filesystem_path($scfg, $volname);
+ # my $id = '0/' . $class->btrfs_get_subvol_id($path);
+ # $class->btrfs_cmd(['qgroup', 'limit', '--', "${size}k", "0/$id", $path]);
+ # return undef;
}
return PVE::Storage::Plugin::volume_resize(@_);
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-03-03 9:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 9:24 [pve-devel] [PATCH-SERIES v2 storage 0/5] unsized subvol regression fix and improvements Fiona Ebner
2025-03-03 9:24 ` [pve-devel] [PATCH v2 storage 1/5] plugin: file size info: be consistent about size of directory subvol Fiona Ebner
2025-03-03 9:24 ` [pve-devel] [PATCH v2 storage 2/5] btrfs: fix volume size info for subvolumes in scalar context Fiona Ebner
2025-03-03 9:24 ` [pve-devel] [PATCH v2 storage 3/5] plugin: volume export formats: avoid superfluous file_size_info() call Fiona Ebner
2025-03-03 9:24 ` [pve-devel] [PATCH v2 storage 4/5] api: volume info: do not fail for zero-sized subvolumes Fiona Ebner
2025-03-03 9:24 ` Fiona Ebner [this message]
2025-04-06 19:59 ` [pve-devel] applied: [PATCH-SERIES v2 storage 0/5] unsized subvol regression fix and improvements Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250303092445.13873-6-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal