From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 08DA81FF15C for ; Fri, 31 Oct 2025 11:37:12 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 93556EB87; Fri, 31 Oct 2025 11:37:25 +0100 (CET) From: Friedrich Weber To: pve-devel@lists.proxmox.com Date: Fri, 31 Oct 2025 11:36:12 +0100 Message-ID: <20251031103709.60233-6-f.weber@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251031103709.60233-1-f.weber@proxmox.com> References: <20251031103709.60233-1-f.weber@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1761907024544 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.137 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 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes 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 Subject: [pve-devel] [PATCH storage 5/5] plugin: rbd: pass rxbounce when mapping Windows VM guest volumes 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" When mapping a volume (e.g., because KRBD is enabled) and the hint 'guest-is-windows' is given and true, pass the rxbounce option. This is to avoid "bad crc/signature" warnings in the journal, retransmits and degraded performance, see [1]. If the volume is already mapped without rxbounce (this can be determined from the map options exposed in sysfs), and it should be mapped with rxbounce, and the 'plugin-may-deactivate-volume' hint denotes it is currently safe to deactivate the volume, unmap the volume and re-map it with rxbounce. If 'guest-is-windows' is not given or not true, and the volume is already mapped, take no action. This also means that guest volumes that are mapped with rxbounce, but do not have to be (because they do not belong to a Windows guest), are not deactivated. This can be the case if a user applied the workaround of adding rxbounce to 'rbd_default_map_options', since this applies to all volumes. [1] https://bugzilla.proxmox.com/show_bug.cgi?id=5779 [2] https://forum.proxmox.com/threads/155741/post-710845 Signed-off-by: Friedrich Weber --- src/PVE/Storage/RBDPlugin.pm | 42 ++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm index 69957d2..7d3e7ab 100644 --- a/src/PVE/Storage/RBDPlugin.pm +++ b/src/PVE/Storage/RBDPlugin.pm @@ -90,6 +90,19 @@ my sub get_rbd_dev_path { return $pve_path; } +my sub read_rbd_map_options { + my ($rbd_id) = @_; + + my $sysfs_config_info = file_read_firstline("/sys/devices/rbd/${rbd_id}/config_info"); + return if !defined($sysfs_config_info); + + my $config_info = [split(/\s+/, $sysfs_config_info)]; + my $options = @$config_info[1]; + return if !defined($options); + + return [split(/,/, $options)]; +} + my $rbd_cmd = sub { my ($scfg, $storeid, $op, @options) = @_; @@ -799,7 +812,7 @@ sub deactivate_storage { } sub map_volume { - my ($class, $storeid, $scfg, $volname, $snapname) = @_; + my ($class, $storeid, $scfg, $volname, $snapname, $hints) = @_; my ($vtype, $img_name, $vmid) = $class->parse_volname($volname); @@ -808,12 +821,33 @@ sub map_volume { my $kerneldev = get_rbd_dev_path($scfg, $storeid, $name); + my @extra_options = (); + + if (defined($hints) && $hints->{'guest-is-windows'}) { + # make sure to pass rxbounce for Windows guest volumes to avoid degraded performance + @extra_options = ('--options', 'rxbounce'); + + # if already mapped without rxbounce and deactivation is safe, try to unmap + if (-b $kerneldev) { + my $mapped_options = read_rbd_map_options(get_rbd_id($kerneldev)); + + if ($mapped_options && scalar(grep { /rxbounce/ } @$mapped_options) == 0) { + if ($hints->{'plugin-may-deactivate-volume'}) { + eval { $class->unmap_volume($storeid, $scfg, $volname, $snapname); }; + warn "could not unmap to apply rxbounce - $@\n" if $@; + } else { + warn "not unmapping volume $volname to apply rxbounce since it is not safe\n"; + } + } + } + } + return $kerneldev if -b $kerneldev; # already mapped # features can only be enabled/disabled for image, not for snapshot! $krbd_feature_update->($scfg, $storeid, $img_name); - my $cmd = $rbd_cmd->($scfg, $storeid, 'map', $name); + my $cmd = $rbd_cmd->($scfg, $storeid, 'map', $name, @extra_options); run_rbd_command($cmd, errmsg => "can't map rbd volume $name"); return $kerneldev; @@ -836,9 +870,9 @@ sub unmap_volume { } sub activate_volume { - my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_; + my ($class, $storeid, $scfg, $volname, $snapname, $cache, $hints) = @_; - $class->map_volume($storeid, $scfg, $volname, $snapname) if $scfg->{krbd}; + $class->map_volume($storeid, $scfg, $volname, $snapname, $hints) if $scfg->{krbd}; return 1; } -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel