From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 60C2F1FF185 for <inbox@lore.proxmox.com>; Mon, 7 Jul 2025 10:03:53 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 143A51D094; Mon, 7 Jul 2025 10:04:37 +0200 (CEST) From: Friedrich Weber <f.weber@proxmox.com> To: pve-devel@lists.proxmox.com Date: Mon, 7 Jul 2025 10:03:27 +0200 Message-ID: <20250707080352.58713-2-f.weber@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250707080352.58713-1-f.weber@proxmox.com> References: <20250707080352.58713-1-f.weber@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.008 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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 pve-storage v4 1/2] fix #4997: lvm: create: disable autoactivation for new logical volumes X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> When discovering a new volume group (VG), for example on boot, LVM triggers autoactivation. With the default settings, this activates all logical volumes (LVs) in the VG. Activating an LV creates a device-mapper device and a block device under /dev/mapper. This is not necessarily problematic for local LVM VGs, but it is problematic for VGs on top of a shared LUN used by multiple cluster nodes (accessed via e.g. iSCSI/Fibre Channel/direct-attached SAS). Concretely, in a cluster with a shared LVM VG where an LV is active on nodes 1 and 2, deleting the LV on node 1 will not clean up the device-mapper device on node 2. If an LV with the same name is recreated later, the leftover device-mapper device will cause activation of that LV on node 2 to fail with: > device-mapper: create ioctl on [...] failed: Device or resource busy Hence, certain combinations of guest removal (and thus LV removals) and node reboots can cause guest creation or VM live migration (which both entail LV activation) to fail with the above error message for certain VMIDs, see bug #4997 for more information [1]. To avoid this issue in the future, disable autoactivation when creating new LVs using the `--setautoactivation` flag. With this setting, LVM autoactivation will not activate these LVs, and the storage stack will take care of activating/deactivating the LV (only) on the correct node when needed. This additionally fixes an issue with multipath on FC/SAS-attached LUNs where LVs would be activated too early after boot when multipath is not yet available, see [3] for more details and current workaround. The `--setautoactivation` flag was introduced with LVM 2.03.12 [2], so it is available since Bookworm/PVE 8, which ships 2.03.16. Nodes with older LVM versions ignore the flag and remove it on metadata updates, which is why PVE 8 could not use the flag reliably, since there may still be PVE 7 nodes in the cluster that reset it on metadata updates. The flag is only set for newly created LVs, so LVs created before this patch can still trigger #4997. To avoid this, users will be advised to run a script to disable autoactivation for existing LVs. [1] https://bugzilla.proxmox.com/show_bug.cgi?id=4997 [2] https://gitlab.com/lvmteam/lvm2/-/blob/main/WHATS_NEW [3] https://pve.proxmox.com/mediawiki/index.php?title=Multipath&oldid=12039#FC/SAS-specific_configuration Signed-off-by: Friedrich Weber <f.weber@proxmox.com> --- Notes: changes since v3: - rebase and run perltidy - reword commit message, add rationale for setting this on PVE 9 only - squash in v3 patch 1/3 that only spread the $cmd definition over multiple lines, as v3 1/3 would have been reformatted by perltidy to use three lines, which defeats its purpose changes since v2: - reworded commit message src/PVE/Storage/LVMPlugin.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm index 1a992e8..83a4ca9 100644 --- a/src/PVE/Storage/LVMPlugin.pm +++ b/src/PVE/Storage/LVMPlugin.pm @@ -405,7 +405,18 @@ sub lvcreate { $size .= "k"; # default to kilobytes } - my $cmd = ['/sbin/lvcreate', '-aly', '-Wy', '--yes', '--size', $size, '--name', $name]; + my $cmd = [ + '/sbin/lvcreate', + '-aly', + '-Wy', + '--yes', + '--size', + $size, + '--name', + $name, + '--setautoactivation', + 'n', + ]; for my $tag (@$tags) { push @$cmd, '--addtag', $tag; } -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel