From patchwork Wed Feb 14 20:51:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13557016 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 608CA128834 for ; Wed, 14 Feb 2024 20:51:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943881; cv=none; b=ky2lPS0Pm2uB/2rHeGqODDy/e2pSSrsC5kyOsffQY46G38NasjrTDBn1OjHUa8jW2ymSm0aju4962rhscRApIsJbavF0NKJrDPnAsOpWkZZLe/Nf60+fNS2m/7FktSEYLVFrktjGFX62i2sLa4KAAO2GRXP6RFMs2020lwz0iRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943881; c=relaxed/simple; bh=9JhTyEY7xyHWHgL2v5AU/Txam2omxdPpwVoZQVdz0Xc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rvoYvzlENN+LgkIvrZ9icQifC/trh1L8T7pIZ1TghKc4acyJNASzX9Yo66RU3kloXU0aOsE4BsRpqqYtMcVpJ1ua7NH3dRKK2qeVU5rmQ6p36+WEp5VfepLt2BwOIwBDC0kx6hqzWULpz9+EPDF/UiXAAv7I33+2KMoQ+chC5+c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=L6F7o2lw; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="L6F7o2lw" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-411e5f21c0bso1364245e9.0 for ; Wed, 14 Feb 2024 12:51:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707943876; x=1708548676; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R3fMdvnxDNyoJn0qP55t3+k8Zw8j30JNS+3y3grOE0s=; b=L6F7o2lwutSTY7OwbTr1C/9Ut/zUegI/Mr1qtOVVD+VxT4fW4pnq7aE5fxReDavIX+ lUp6Bkbm17dwzgqJuL6TLFap5MlSX8smpPbrRLgVVVaGEEcZh4eeg2joM6dVMAgLAaVt gVEn7HEwX0L7AMZJnUIY/0krMEeUnieAv2CKa89+0xocShDSUF7FgEMMWc9+laFU6QCA nB6vs68pN6p8wxkrtgmOcbxjYp3gLeORcOCLRUP7XfUQ0tdgEvUl3EDe465YS8PYk5u6 Wz8V/SRbFxGHXjPCvAOiK7/gmosGPUO2+q/Gr3+Czu9Y+dJQIItfwKyJxKNHkLv0gLs6 GS8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707943876; x=1708548676; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R3fMdvnxDNyoJn0qP55t3+k8Zw8j30JNS+3y3grOE0s=; b=t+U4jupWSwvittN6uBDgxtOeuV31DJBanIAuGLk1mvRHujTKYfL2cQRKCM1AL5Txfv +YEGLb2FPg7UROxmPJeGiCwRqDV9o8juM4LZsFlU2ioKUXqMz1e2qR0aaewOZJh2dARj cxYl8FSc5SJf1o3aavvkzp5xqQPE6d9XzhhkoyKK0NmmqRVyyHXBbVmXv+RV4/fpDiE7 n8JGdIAxK/sBr+aTV27rChhVou6Yp3vnQY7d8guhWWGZ4a1SF89+Fs4wxg+qsBi8NUVE gTBJjRqud6nAn4CxGPOQ7/kWOlAyWMVWOX9ltEWCHfdLMpHcM96bsxb1JuCnDCyXij66 IQ5A== X-Gm-Message-State: AOJu0YwA6GyxhywtJI2YKFGQKgyPwER7i/4YdUOdMx4sOmd1ntjeLxJE f4blNhpZfgFVZqpO5zamVLEKAfC2cetlno17Z8jQgmtThbehKKGtbXUplr1QpY4= X-Google-Smtp-Source: AGHT+IFWZ3VwL7fXicmlkFfuIdGDWG21aH4eSIrnVxKd+mgir5EYGAmHsoSc9XEGyUP4lsddorox5g== X-Received: by 2002:a05:600c:354c:b0:412:195:c00a with SMTP id i12-20020a05600c354c00b004120195c00amr954102wmq.4.1707943876675; Wed, 14 Feb 2024 12:51:16 -0800 (PST) Received: from localhost (dslb-002-202-118-224.002.202.pools.vodafone-ip.de. [2.202.118.224]) by smtp.gmail.com with UTF8SMTPSA id 18-20020a05600c231200b00411a0477755sm2930654wmo.9.2024.02.14.12.51.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Feb 2024 12:51:16 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, linux-lvm@lists.linux.dev, Zdenek Kabelac , Peter Rajnoha , Martin Wilck Subject: [PATCH v3 1/6] 11-dm-mpath.rules: use import logic like 13-dm-disk.rules Date: Wed, 14 Feb 2024 21:51:02 +0100 Message-ID: <20240214205107.27409-2-mwilck@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214205107.27409-1-mwilck@suse.com> References: <20240214205107.27409-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We have to import the properties if either DM_NOSCAN or DM_DISABLE_OTHER_RULES_FLAG is set, because blkid will be skipped in both cases. Also, if DM_UDEV_PRIMARY_SOURCE_FLAG is not set, it makes no sense to try and import the properties. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipath/11-dm-mpath.rules.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index b3117f9..e7be12d 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -79,7 +79,14 @@ ENV{MPATH_DEVICE_READY}!="0", ENV{.MPATH_DEVICE_READY_OLD}=="0", \ # not. If symlinks get lost, systemd may auto-unmount file systems. LABEL="scan_import" -ENV{DM_NOSCAN}!="1", GOTO="import_end" + +# If DM_UDEV_PRIMARY_SOURCE_FLAG is not set, the properties below +# have never been properly set. Don't import them. +ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="import_end" + +# Don't import the properties from db if we will run blkid later. +ENV{DM_NOSCAN}!="1", ENV{DM_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="import_end" + IMPORT{db}="ID_FS_TYPE" IMPORT{db}="ID_FS_USAGE" IMPORT{db}="ID_FS_UUID_ENC" From patchwork Wed Feb 14 20:51:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13557015 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EE1713A264 for ; Wed, 14 Feb 2024 20:51:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943881; cv=none; b=TJC6yycd65zRM8eVGoWlh9pJlYMaGkneEgQCHR8fK8JIvnrLiXCoGCcgA0TQs1575YtE0zqEd+MI9ml1UULns1Vf3QB6OB64DwHYqJfRJS+WsW/9MmA2wIKvihEW3VF6tw85m80aA4gD+P7RN1aezHgE0O/W/DxnrL+Zxce2Qh0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943881; c=relaxed/simple; bh=CzZ10ebMl8Aq88rtRWQiE6iaWZ9AnGpBYpJc/9ul6Hg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fRGoxs6byRIzMoVp4GYXsUjgDeG/hRmPJkHwFl/NPOpk/hbwkPkE8dTacw0lZly0cdcDWvoXt3Y0kLiwAEdVeJt374TBEcnvT7a8/2XgWtgP8Og2/0w2aKLLK6ktwnvXx962HhOQr8OAi8Er/TqGUNLt18CiHfbDBfCvMj97uLQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=eReCVEHt; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="eReCVEHt" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-411d253098eso1110395e9.3 for ; Wed, 14 Feb 2024 12:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707943877; x=1708548677; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T5jWCKVtO1cjEeo6EXqTxx4ngqmzQtxCdaslRQfg+ZE=; b=eReCVEHtsmP3zjf5KNwceSuP16fU4s48Yig/GbkVFvvvSsVIWSXGPH1WU/zhzqtf8X aeMf+l1ztJsvpTSiTwA4eF8vng/5Gz3NmqETColrDy/7islQFfM1LLreUm8iZCO8GcM1 Cergxyvoq2eHevvLJt0YlSSDPEjRBDK4KbO9Alm+BgCE3Bmq5Zbw0Hu6ZdDCHOOEs7ur z+YYdrE+RLLnKb6U9Qj5tlr1zkwk9S/9mKjnvWLor7xWVhHDbuUNITIsRwhSK++KaCae BbtO5YcswJTbYeMUgiR2OT3PM/4RuZdY4rC1VHZwfC+RxUhdGj5SUgDjNx7PIbbGMaYK Z9rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707943877; x=1708548677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T5jWCKVtO1cjEeo6EXqTxx4ngqmzQtxCdaslRQfg+ZE=; b=AnSSUbC3xp8tDx1fgwz/F8Aotvl5HVJyI07LBANa56gH3yvn/GnqJTtW/X0DGgSJbf KP3mssEwr+8cgSw/LQ2lpzt1NbsEXPqFTexZMsBYEwZQdP8t0pEHCSlPVCVksE03KqSo UMwoIBKTsJ2Az9hLWQtf4wYr0x6TffiVjizLdqTqNVunOh+wo/DHfLAHoC97/qpirYEo ARk0C+qnLxr26CC7WM1Ol+J9YhfZEIThCV8QzMTiOXZdWshsCC5+tBjqWl3ke0DIS9yG Sdu4ZNv6d5ZPULIz/dwwItFbiarIbZUcU+Vkcpr4ouW/5L6njpcmiz+i+wZTWk4mpHsv IDNg== X-Gm-Message-State: AOJu0Yw99y/SN7rUo3Cs5iec1sMALMB/YgQxMLxdI2AIu2GQlhLEVePZ 4loarTrmxkplfQpE57r6VYfoKDLcNjLQVTltiHkWnXza2OoyfGI5xuHFFREmHYG2Dgn91QH9y4X A X-Google-Smtp-Source: AGHT+IE0KTUqu6XUahTzkKdhpRUtF5qAqbWDhi31XH5NABrEPlHVKa953lMyHCDxUqz/Q7k7nEK+zg== X-Received: by 2002:a5d:6387:0:b0:33b:60ca:2219 with SMTP id p7-20020a5d6387000000b0033b60ca2219mr2652858wru.45.1707943877674; Wed, 14 Feb 2024 12:51:17 -0800 (PST) Received: from localhost (dslb-002-202-118-224.002.202.pools.vodafone-ip.de. [2.202.118.224]) by smtp.gmail.com with UTF8SMTPSA id y5-20020a7bcd85000000b00410ab50f70fsm2868017wmj.15.2024.02.14.12.51.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Feb 2024 12:51:17 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, linux-lvm@lists.linux.dev, Zdenek Kabelac , Peter Rajnoha , Martin Wilck Subject: [PATCH v3 2/6] 11-dm-mpath.rules: don't import DM_UDEV_DISABLE_OTHER_RULES_FLAG Date: Wed, 14 Feb 2024 21:51:03 +0100 Message-ID: <20240214205107.27409-3-mwilck@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214205107.27409-1-mwilck@suse.com> References: <20240214205107.27409-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DM_UDEV_DISABLE_OTHER_RULES_FLAG is handled by 10-dm.rules, which imports it from db if necessary. There is no need to do this again here. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipath/11-dm-mpath.rules.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index e7be12d..fd8d202 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -7,7 +7,7 @@ IMPORT{db}="MPATH_DEVICE_READY" # If this uevent didn't come from dm, don't try to update the # device state -ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", IMPORT{db}="DM_UDEV_DISABLE_OTHER_RULES_FLAG", IMPORT{db}="DM_NOSCAN", GOTO="scan_import" +ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", IMPORT{db}="DM_NOSCAN", GOTO="scan_import" ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}" From patchwork Wed Feb 14 20:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13557017 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8045C13DBB1 for ; Wed, 14 Feb 2024 20:51:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943882; cv=none; b=avl11qxpt5aq+EgoBZwzQM7LzQgfIlOU7GTApnWorJEWeqERrKCgr4IsArIXY8DiRa9LmZyLWVZ5XG1Ty0l0nMAEfN/1PHkblRJTzQNjWUhdIt1C873yAx4CCULEAoAuGZqXKbOy1mqprrWFkvDOd7obKsAK9HJeTPtaMspNZDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943882; c=relaxed/simple; bh=ivwkGmobRxlL6s9jVzf5flLAPPNnw+75G8gKKeWOpOo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z7F1+YL0DtvyIW6wsuo6xLwDCfAhGo6VpdTcxi7tKTELOE1LlVZP4RbKOtYT6HjNED4Up1wIGi1AmhbCezRP9EkDKTD+EENgAJugVd3p8BRgxuY+4h/fKKWqcKTN/M2pLLyFDjaphS5zowk4fnfrj+9BHqTgcJ6Wx85nDz6v6T4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=dL4sbu9B; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="dL4sbu9B" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-33b66883de9so84589f8f.0 for ; Wed, 14 Feb 2024 12:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707943879; x=1708548679; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sHC3w8hhA56btU+YHtKHI+hkqGd95pZ8G3TkiL54B+M=; b=dL4sbu9BYQFLm7BlCfqmHWfCKsaeRfvU89PdZUvmdHDXdvD7oUHokjlnzjefruV7QX W49wOLlkEHy0SQPT0T3pMH3eJc5r8rsmwiFVGy+ux+OZNuE27BUbAIPaM1IjUpT9ZkHr M+CEKqdLf5k8b5JU9U6iweC1ipRt0T+UA2ix+H+/5ajlsQWqLCrrE3N5VJDYjWvNBM2Z 1ErSNbEDRCav7gcRWt03LX9MBu5L906m6dIlh94g29rWVqo3XceCVSKpHh5eJBIbQfCk zCVIWfjI6NyPFr7EsdbvafmidXePECbcXYwXELWaEjmKbFzxCeMeTjmLnYHvClMEwY+r iatA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707943879; x=1708548679; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sHC3w8hhA56btU+YHtKHI+hkqGd95pZ8G3TkiL54B+M=; b=cbNcMNZy+YR5Cs4i5dIvbqeJ6VNuCOvaFF7OykQSyK9WXg8RwEcas39y8dvikTIT95 MonQWCqrmCrxWxKZcJt+Sb7uNvbNaudvK9o+B22bIfWgaMCgkqsxXMcF22S0Pu8fFXgJ kQ1KNzWTnHunQzGRhQ5QDGpOzOizs45pBTyKYbzNN9yWi1EGUGlqHnE+vpiaiS9GBpl0 GNzMZBAUjeIgZv0RKl+zIdZxBj+Bnr9B32SbKxxmYNYZw+p0DVh9coXoJy+jZ0QAgHYK UTnka5NidLAj7FuabQhk41BErXNjSJ8/LwyHcRvo7A7dq7Dzkkk80UwctLzL1aGY8gYW 85FQ== X-Gm-Message-State: AOJu0Yykd6kfW14+OqbZb7TpLZgGw4RXmykFa6+asfMj7iOzL4IQRjpl aL01SAUfvVH/SzXhilROE6f2jNO71w/sE8+Q0X0cnIiCqHh1reyA29EbabyfgZQ= X-Google-Smtp-Source: AGHT+IHjlKGp+FVUsXWuJrE/ktOSClTeHkCfkPDR1QqxjtwoVUUId8pnKitYPil7Gk6FP4I1LV8+vA== X-Received: by 2002:a5d:6982:0:b0:33b:1bf2:18cf with SMTP id g2-20020a5d6982000000b0033b1bf218cfmr2665556wru.17.1707943878854; Wed, 14 Feb 2024 12:51:18 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUR2Klqfxe/x/+xP2ii3L0IpxSsA5sKoU/WfVwnmeHZzV4159G4GcO90wWpvPcDPvBoNxQn4hwYPhDvhvMLAYyRGJL6GeFFkdQJ1fMSH4bTjaPJsTbm0a5grjseJPpaKI0etBVCWmsAtJbNzubFNUc8vYqcG0XlmrSXzROorYcyEmO1hdJJWz5WpLlkKd/dIz9G74nMpGlKlcw= Received: from localhost (dslb-002-202-118-224.002.202.pools.vodafone-ip.de. [2.202.118.224]) by smtp.gmail.com with UTF8SMTPSA id v5-20020a5d59c5000000b0033b8305ffe2sm8947026wry.87.2024.02.14.12.51.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Feb 2024 12:51:18 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, linux-lvm@lists.linux.dev, Zdenek Kabelac , Peter Rajnoha , Martin Wilck Subject: [PATCH v3 3/6] 11-dm-mpath.rules: handle reloads during coldplug events Date: Wed, 14 Feb 2024 21:51:04 +0100 Message-ID: <20240214205107.27409-4-mwilck@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214205107.27409-1-mwilck@suse.com> References: <20240214205107.27409-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If a map reload happens while udev is processing rules for a coldplug event, DM_SUSPENDED may be set if the respective test in 10-dm.rules happens while the device is suspened. This will cause the rules for all higher block device layers to be skipped. Record this situation in an udev property. The reload operation will trigger another "change" uevent later, which would normally be treated as a reload, and be ignored without rescanning the device. If a previous "coldplug while suspended" situation is detected, perform a full device rescan instead. Signed-off-by: Martin Wilck --- multipath/11-dm-mpath.rules.in | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index fd8d202..30d6e78 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -5,9 +5,16 @@ ENV{DM_UUID}!="mpath-?*", GOTO="mpath_end" IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD" IMPORT{db}="MPATH_DEVICE_READY" +# Coldplug event while device is suspended (e.g. during a reload) +ACTION=="add", ENV{DM_ACTIVATION}=="1", ENV{DM_SUSPENDED}=="1", \ + PROGRAM="/bin/logger -t 11-dm-mpath.rules -p daemon.warning \"Coldplug event for suspended device\"", \ + ENV{DM_COLDPLUG_SUSPENDED}="1", GOTO="scan_import" + # If this uevent didn't come from dm, don't try to update the # device state -ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", IMPORT{db}="DM_NOSCAN", GOTO="scan_import" +ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", \ + IMPORT{db}="DM_NOSCAN", IMPORT{db}="DM_COLDPLUG_SUSPENDED", \ + GOTO="scan_import" ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}" @@ -43,6 +50,16 @@ ENV{DM_ACTION}=="PATH_FAILED", GOTO="mpath_action" ENV{MPATH_DEVICE_READY}="1" LABEL="mpath_action" + +# A previous coldplug event occurred while the device was suspended. +# Activation might have been partially skipped. Activate the device now, +# i.e. disable the MPATH_UNCHANGED logic and set DM_ACTIVATION=1. +IMPORT{db}="DM_COLDPLUG_SUSPENDED" +ENV{DM_COLDPLUG_SUSPENDED}=="1", ENV{DM_SUSPENDED}!="1", \ + ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0", \ + PROGRAM="/bin/logger -t 11-dm-mpath.rules -p daemon.notice \"Forcing activation of previously suspended device\"", \ + GOTO="force_activation" + # DM_SUBSYSTEM_UDEV_FLAG0 is the "RELOAD" flag for multipath subsystem. # Drop the DM_ACTIVATION flag here as mpath reloads tables if any of its # paths are lost/recovered. For any stack above the mpath device, this is not @@ -57,6 +74,8 @@ ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", \ ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", \ ENV{DM_ACTIVATION}="0", ENV{MPATH_UNCHANGED}="1" +LABEL="force_activation" + # Do not initiate scanning if no path is available, # otherwise there would be a hang or IO error on access. # We'd like to avoid this, especially within udev processing. @@ -99,6 +118,9 @@ IMPORT{db}="ID_PART_GPT_AUTO_ROOT" LABEL="import_end" +# Reset previous DM_COLDPLUG_SUSPENDED if activation happens now +ENV{DM_SUSPENDED}!="1", ENV{DM_ACTIVATION}=="1", ENV{DM_COLDPLUG_SUSPENDED}="" + # Multipath maps should take precedence over their members. ENV{DM_UDEV_LOW_PRIORITY_FLAG}!="1", OPTIONS+="link_priority=50" From patchwork Wed Feb 14 20:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13557018 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9677813EFF9 for ; Wed, 14 Feb 2024 20:51:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943883; cv=none; b=iGaeBgHKA69jYa/lmNrX3rRZdD7/miq0ILuLhJoqkxWR13dyR1yeANC1YtsK6/h0Piy/Q4N4zOntosZDKYp5rga58jUuuCy49W0SQyVYu/U+eK2aQ60PADzFMmZUbQvOIRRXvYdmdD121FO36pOU9ZXqjRVS1fwuKY5R6lw6zEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943883; c=relaxed/simple; bh=jgKEgm4ZraICoCHymTIQvfbSA2WbNIfHL33U9oFEpvY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BKSRPFOu1taZhAlehhT8PPNMcTfY56rzdkMoh4m798NPuqtbdODMgdAiOvQw4wyUVW1oSxlF2FKvyGJUiRqOC19RpXfD7bjpSeeHh0f6IZff5l6+X2BbmMZr9RqeqpUrh5KTOo85I9EMtVELYNxVplrlPeERDhEZ/ul4KN8WXPo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=OwVgAY30; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="OwVgAY30" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-33cda3dfa06so76120f8f.3 for ; Wed, 14 Feb 2024 12:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707943880; x=1708548680; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ECRVgGd7IM3p72ApRmUJhCPMAqicgF1lw/pIMkF65I0=; b=OwVgAY30f77L4TXSE+KsbQow4ifu0Cqs6ab+7FTJd3dfcyALdP+OXOdEf1VNK3861j osPvGrER1OpirE23BSbQ/SZ5ZlBdLCiXiVIBjzVVkcZEmwQJbb2JILvt5WB6xKHE3gtJ 7QGsh0igcnq3C1KUh/AC9ikluRSKotsW6pvsz+UWuRqv0mhrbncytpnSNaukYG5yEMHI 1Fxespn8d2oFeeM7uw/5OdQGzOtpY4H5d4qXl+5xXnsd4K9GRoQOmX53F29lJ3PxKrKc RKEGHLm4SdQsxae14hBNmBzpduNwMW5xaK69J8kugTdNZ+o0NiEGxijhtFaRJeAUoqPO rHtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707943880; x=1708548680; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ECRVgGd7IM3p72ApRmUJhCPMAqicgF1lw/pIMkF65I0=; b=BBavjjElzgiHhuZWCLbW/0CdFvu7ERjRx+QwVHRWGyJ8+4ZOn+MSjh8Zb8pJVUzkNX Befra3Nb6VlxjAdSrHgHLxeur8Mfaf1odU5wNIgR8AEqSqFNJ+oiwVotGLTx9skqm1D1 lqM+DVuGPek9eWey3NzQlXN8VGZnti1NamHSlFH0E08IX0PUXw1dC8e6kA0x7r2e8PUX 4qfiTdEPCHIyRt1oGTSqjkh8jYNlwCDuGwUtLQMF+7/rHnUJZzqRe2TemLpbv3eIC7GP eX0qJIwS5oN2DFlTQ54vhmQhGKU4ss0DSb2qiMqxlupN2nB0Axcd7WuwmnWN5HBU0TYk L35Q== X-Gm-Message-State: AOJu0YybKLTOmKtdJRR29tTzscb5GV6KzounQ5eb7taLUZUC6wYcjYzJ +inU55GhPQ1cTvoTACZyedmaBJuuGD2lRuS940RuuhMVKZGwlxs1UOgIQyCY1D8= X-Google-Smtp-Source: AGHT+IHeo3TxfBDiFPozfiB1BCqlasTbJRuoWJDBrcMgGwtUBSFMGJvFT/8wqg7vJ2Cz8a0/2PX2vA== X-Received: by 2002:a5d:6387:0:b0:33b:60ca:2219 with SMTP id p7-20020a5d6387000000b0033b60ca2219mr2652908wru.45.1707943879851; Wed, 14 Feb 2024 12:51:19 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW3LK+jv8qKatLOClulz+nNp9+SZeQ7P9k1eiXzngyNTOlrKMGtFMy8rWPq8nEJayGnYf/QTiPDosZSi9lj5uJBRqvTzfixOHXoqSFsBXP/a7zsw+v829feFnmGvuNcyOqF3q6fjP++mWCpg8gg6z0TGvf33DlwCFUDU7Re4SAXOF2b+SfGCAzy8PjqskdVnl+wa25HbKbEtTg= Received: from localhost (dslb-002-202-118-224.002.202.pools.vodafone-ip.de. [2.202.118.224]) by smtp.gmail.com with UTF8SMTPSA id bx31-20020a5d5b1f000000b0033b5ee36963sm13592634wrb.23.2024.02.14.12.51.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Feb 2024 12:51:19 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, linux-lvm@lists.linux.dev, Zdenek Kabelac , Peter Rajnoha , Martin Wilck Subject: [PATCH v3 4/6] 11-dm-mpath.rules: don't save DM_UDEV_DISABLE_OTHER_RULES_FLAG_OLD Date: Wed, 14 Feb 2024 21:51:05 +0100 Message-ID: <20240214205107.27409-5-mwilck@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214205107.27409-1-mwilck@suse.com> References: <20240214205107.27409-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The current rules overwrite DM_UDEV_DISABLE_OTHER_RULES_FLAG and save its value in DM_UDEV_DISABLE_OTHER_RULES_FLAG_OLD if MPATH_DEVICE_READY changes from 1 to 0, and restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from DM_UDEV_DISABLE_OTHER_RULES_FLAG_OLD when MPATH_DEVICE_READY changes back from 0 to 1. This is wrong for multiple reasons. For "spurious" events, 10-dm.rules will read DM_UDEV_DISABLE_OTHER_RULES_FLAG from the udev db and obtain the value saved by 11-dm-mpath.rules rather than it's own saved value, which confuses the logic in 10-dm.rules. 10-dm.rules sets the flag if either DISK_RO==1 or DM_SUSPENDED==1, and never clears it (it can only be cleared by a new genuine libdm event that doesn't have DM_UDEV_DISABLE_OTHER_RULES_FLAG set, while the device is not suspended). lvm commands may set the flag, too, but AFAICS this is only done for certain types of logical volumes, not for multipath maps. If a previously suspended device is resumed, DM_UDEV_DISABLE_OTHER_RULES_FLAG would be cleared, and it would be wrong for 11-dm-mpath.rules to overwrite it with a previuosly saved value. Likewise, if a uevent arrives for a suspended map, and MPATH_DEVICE_READY happens to switch from 0 to 1, it would be wrong to clear DM_UDEV_DISABLE_OTHER_RULES_FLAG by setting it to a previously saved value. We need to set DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 to prevent follow-up rules from attempting I/O on the device. But don't try to save and restore DM_UDEV_DISABLE_OTHER_RULES_FLAG between uevents. Rather, reset DM_UDEV_DISABLE_OTHER_RULES_FLAG to the value we got from 10-dm.rules in a late rule. I chose "99-z-" for this rule's prefix to make sure it runs after 99-systemd.rules. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipath/11-dm-mpath.rules.in | 19 +++++++++---------- multipath/99-z-dm-mpath-late.rules | 4 ++++ multipath/Makefile | 2 ++ 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 multipath/99-z-dm-mpath-late.rules diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index 30d6e78..cada176 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -2,7 +2,6 @@ ACTION!="add|change", GOTO="mpath_end" ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="mpath_end" ENV{DM_UUID}!="mpath-?*", GOTO="mpath_end" -IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD" IMPORT{db}="MPATH_DEVICE_READY" # Coldplug event while device is suspended (e.g. during a reload) @@ -81,16 +80,16 @@ LABEL="force_activation" # We'd like to avoid this, especially within udev processing. ENV{MPATH_DEVICE_READY}=="0", ENV{DM_NOSCAN}="1" -# Also skip all foreign rules if no path is available. -# Remember the original value of DM_DISABLE_OTHER_RULES_FLAG -# and restore it back once we have at least one path available. -ENV{MPATH_DEVICE_READY}=="0", ENV{.MPATH_DEVICE_READY_OLD}=="1", \ - ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}=="", \ - ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}" -ENV{MPATH_DEVICE_READY}=="0", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" +# Skip all foreign rules if no path is available. +# Use DM_UDEV_DISABLE_OTHER_RULES_FLAG to communicate this +# to upper layers. The original value will be restored in a late +# udev rule. +ENV{MPATH_DEVICE_READY}=="0", \ + ENV{.MPATH_SAVE_DISABLE_OTHER_RULES_FLAG}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}", \ + ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" +# If the device comes back online, set DM_ACTIVATION so that +# upper layers do a rescan. ENV{MPATH_DEVICE_READY}!="0", ENV{.MPATH_DEVICE_READY_OLD}=="0", \ - ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}", \ - ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="", \ ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0" # The code to check multipath state ends here. We need to set diff --git a/multipath/99-z-dm-mpath-late.rules b/multipath/99-z-dm-mpath-late.rules new file mode 100644 index 0000000..8574b1a --- /dev/null +++ b/multipath/99-z-dm-mpath-late.rules @@ -0,0 +1,4 @@ +# If DM_UDEV_DISABLE_OTHER_RULES_FLAG was modified in 11-dm-mpath.rules, +# restore it here, lest a temporary value be saved in the udev db +ACTION=="add|change", ENV{.MPATH_SAVE_DISABLE_OTHER_RULES_FLAG}=="?*", \ + ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{.MPATH_SAVE_DISABLE_OTHER_RULES_FLAG}" diff --git a/multipath/Makefile b/multipath/Makefile index f8c1f5e..67fb5e6 100644 --- a/multipath/Makefile +++ b/multipath/Makefile @@ -26,6 +26,7 @@ install: $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) $(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) + $(Q)$(INSTALL_PROGRAM) -m 644 99-z-dm-mpath-late.rules $(DESTDIR)$(udevrulesdir) $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir) $(Q)$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf @@ -46,6 +47,7 @@ endif uninstall: $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC) $(Q)$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules + $(Q)$(RM) $(DESTDIR)$(udevrulesdir)/99-z-dm-mpath-late.rules $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules From patchwork Wed Feb 14 20:51:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13557019 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C5C1128384 for ; Wed, 14 Feb 2024 20:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943884; cv=none; b=NhSgD0DTCi/9DeIyZKoL80m9srnvYEGN/oMOxmXNEOO3R8C5Pk9CNe5W7ogktihqC/sNZ13Jm9MYRf7WRMVeoS2ep1hsIphwIcIZ0loxnT4Y8vVzS9k5W05BJaMPY8DGI+CnXqe8KRolsuMG1AkoJOkIkGmjIR290uJbw7RagoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943884; c=relaxed/simple; bh=lyd+Hn5EV1Jxlzol4gxngwuwjTdxREoiMADFtespBH4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E03mfY2qmSetdG2U5PnVVhWK7zM8L6D2TgOxu359HvigJEmzk4ZEetP1967SnwjA50ml4Tlq9ZZ/xVjxlUq4OHFh+pmWczTtqHqUNdks8405zqxwj69QWdkQj9lWDtOoBY8JRt0PoCnr2iJQvY0nN02U6Sd0hoZM+/nDMafj28k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=HrKu9ci6; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="HrKu9ci6" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-411f895c8b6so1272995e9.1 for ; Wed, 14 Feb 2024 12:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707943881; x=1708548681; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5kOug5bTIRYU66LDQvPGyaqGUA0HW8HK8OywBmD/pqc=; b=HrKu9ci6x0Fm7ork8chUs98EJfHcaxqMsNmia7m43ecfLcn7FHq8jtp7lWZ7b75oVI CQYmwlI1o+m6P0QWyZxSJALps5iRXBfSpOGf6MipnRc15ke3/8f8SIJbWce+fOFMuUWg 47zMkE6zhpq66Xf0ESrZLQ/61CXjZenTiHp2B6wBXtjV7MjLg35fyrjbcY+47iupz8rF Fr41HWcKu1pk5/Goevi2zy0Ne/2bz01IGkeFQv1bOzGAi9xR819l9uYJR9xyB5jDmaST h2vTyf+Bf+0RsDbKfYrIR9jZcR6hbmKOoGU10MRDGzN6M2MvDIgWlsfFdttf9tgRUf3g kVHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707943881; x=1708548681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5kOug5bTIRYU66LDQvPGyaqGUA0HW8HK8OywBmD/pqc=; b=pLvD0Ns8x//5m+pV5TS7eNsfGAE7uajQH6YP/BV0t1u+uwXzY+0R3av99iZv1v6oe9 kc3+zAB8F/kfe+TIe8MDCYi4ED2gUKGh4B5PxZG4P8rO1fBfrbgguJqB6s1/a3RzTaHh Z2uoMXT6ltn8gaQ8TcqwSmxrklsypUbkQbIcXw1iVblP4vjrZ6wmOVzljTtLdwfGJx4W a/6A2QUZVyQIaF/q8zvLSe5RylSs0oPiyzqdbfU6T9z8IxFO5GIjpw4D6xCfXa0veqr1 /XXWB1QYKMfI/6Me4Pm1wgSoS0lnYQ+g0cv8XCOtqu+upo5lFA3+ikjYrLzVottuBlsx Xa2g== X-Gm-Message-State: AOJu0YxSgEizkl+i4qPTv2Bmgt7lQ0XsRoxK8JYf+RVqjTXlXv/+DZKj Y6Yo7SbbTlHAMIJ6b+eaRbdlz6gPwnftlWBiL23KbnjdfC+JMMSCfNoPCjV2xUlJ44uyZw2INud v X-Google-Smtp-Source: AGHT+IENexf8wmIWmmSO9xoMcnNML9q7FWBzYStSB/nNQI5tiYc8qVK6aPkezCQ2dhZebpBlUoYqXw== X-Received: by 2002:adf:f4c7:0:b0:33c:e1f8:9444 with SMTP id h7-20020adff4c7000000b0033ce1f89444mr2487029wrp.9.1707943880849; Wed, 14 Feb 2024 12:51:20 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUaSqhRY4VbjQtyiM+/VAgXHbDuDXfBmXxn9V1NVWq1+GYuLqMDsreKILlNSl96QjUG31HdmHxuiDBGJ3+95xXnFH6mxEUdIa1GWd0SXvhEeA9gxh5tEGQLGjB9Ry6guOG/xYaUh5ge9FbimFDOuvpkbPJrwXZ2fTGmg51l65IzLpO7NTkLnEPu7AyHg7lP0df25JpMxJYll6M= Received: from localhost (dslb-002-202-118-224.002.202.pools.vodafone-ip.de. [2.202.118.224]) by smtp.gmail.com with UTF8SMTPSA id h2-20020a05600016c200b0033cf041c03csm2295840wrf.55.2024.02.14.12.51.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Feb 2024 12:51:20 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, linux-lvm@lists.linux.dev, Zdenek Kabelac , Peter Rajnoha , Martin Wilck Subject: [PATCH v3 5/6] 11-dm-mpath.rules: clear DM_DISABLE_OTHER_RULES_FLAG for coldplug events Date: Wed, 14 Feb 2024 21:51:06 +0100 Message-ID: <20240214205107.27409-6-mwilck@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214205107.27409-1-mwilck@suse.com> References: <20240214205107.27409-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For all "spurious" events, which includes coldplug events, DM_DISABLE_OTHER_RULES_FLAG will be read from the udev DB in 10-dm.rules. Thus if a previous event saw the device in suspended state, the flag will be set even if the device has meanwhile resumed. Reset the flag if none of the conditions hold that would cause it to be set in a genuine uevent in 10-dm.rules. It would be cleaner to do this in 10-dm.rules directly, but it cannot be done easily, because the flag can also have an origin inside lvm itself; lvm sets it for various kinds of logical volumes. For generic (non-LVM) dm devices, the flag is only set in 10-dm.rules though, so doing this is safe for multipath. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipath/11-dm-mpath.rules.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index cada176..82b0204 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -9,6 +9,13 @@ ACTION=="add", ENV{DM_ACTIVATION}=="1", ENV{DM_SUSPENDED}=="1", \ PROGRAM="/bin/logger -t 11-dm-mpath.rules -p daemon.warning \"Coldplug event for suspended device\"", \ ENV{DM_COLDPLUG_SUSPENDED}="1", GOTO="scan_import" +# Coldplug event. DM_UDEV_DISABLE_OTHER_RULES_FLAG has been restored +# from DB in 10-dm.rules. If the device is not suspended, clear the flag. +# This is safe for multipath where DM_UDEV_DISABLE_OTHER_RULES_FLAG is basically +# equivalent to DM_SUSPENDED==1 || DISK_RO==1 +ACTION=="add", ENV{DM_ACTIVATION}=="1", ENV{DM_SUSPENDED}!="1", ENV{DISK_RO}!="1", \ + ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="", GOTO="scan_import" + # If this uevent didn't come from dm, don't try to update the # device state ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", \ From patchwork Wed Feb 14 20:51:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13557020 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7567D13F006 for ; Wed, 14 Feb 2024 20:51:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943885; cv=none; b=k7lRgYeEkp7V0Q2XYTC0ZqHHz5Z6kw6gObrjvHDFHb6Bf20ktZflpJj/rqsUBp6V60bpgo8WUpJbfsx7XZTaAywl4AA5qnq7LE3A+alh931kb2hC3s81hI0wJZUQkazIBNt7BmUifF0tKPURrVWjyAIqVDiM9HUEODj8J9jb108= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707943885; c=relaxed/simple; bh=8ii43dcIOvaGlkTQI5a9x4SLyaKVdZcok+JcSQCq1v8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=po38msBkafVALPW/BQKre4vNSPRLBgtLrIkhwTnJrkZhNrrGZjV07m1qs9t3c5+oy4IqLZXoBTL6fYPimyj9ipddmZWoip2PHQpn+1fTBE3yKuzeuQaRb5LVTTZbBCCLsPp+h1lx5MvZes6dBBkFlGU3tYeNd9UMFQAQYwAeoJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=XzBfWjEA; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="XzBfWjEA" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-411e71d8a2bso1182495e9.1 for ; Wed, 14 Feb 2024 12:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707943882; x=1708548682; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1MvAnuyEhxa5f26HahF6d0WwkUZuummZ+wTGxjRyFuM=; b=XzBfWjEAzxJbGKrz30nvEYWBlROMaLHSDE/sdkw5SvJgTUweUKn1UBNDYZsVYOgy0d HjicRKP5+ZHq6aC9XwLlccL4cVc1LPmnCbs8V2DPcqUFeiZQ014C9eo3s4KLq72M3aRy 1oZg/AbIsooKaIlw3r+bS78UB/TCuOc+08bW1wrWDGmwOysC0srzjxBK8RFbHaVZY68V nhtxTbNUfsvUSGd+kJXUd+cWwju7CuPBhdS6l9vX/QtRJrqujK9rHwwdxUdbHzZcFkI1 hQ8fGpu295Q7aFtwNod2fiLtqPpR60q2uYdIhr+tHHh1+bOVBiMqks4pa9wJjxHha/vx In3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707943882; x=1708548682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1MvAnuyEhxa5f26HahF6d0WwkUZuummZ+wTGxjRyFuM=; b=YgS/fhzCHokLanaWDxWl+pUNpkGNy3fN//BMPyF62svWKVHWeW/hbkSPZLlWfx0kNo RGG4qog4uorIJwV90MVDj78YaKWuuLyLnQbGoGIZyPBK4jbAkRK+OsosjKC8YcQEqK4k rS6OZ/+jqPhMEcnW8ENAEUL7eu3gEeKbPRsBorvNSd6RpKZ5m3bSxaj6tAZ8VgGeRSGh uvTb229TIHbhqqfoFX3rVeqJyYM4OaWhztSgFuToj7jU+pGkLb3mNYciiFCggwmrFN/N gcM477oirpmZv7q1Ng9QbuDjR1xquJFLWSfae35bfdTJzrHJDQAbe4f+3vEMlYK33M1o uHMg== X-Gm-Message-State: AOJu0YxqsGQlfdRm8Hno/ei16jZBRIluOmRAMjN/758+4/3Vqrmh4xRq Z3paa6xe4Efo+so0rtjSwaCCPXiqybnaniJ2lYQwDHNF6tgxRoXY8G/ocBxLQLE7G0412Zwkjc9 D X-Google-Smtp-Source: AGHT+IEJwUcWLGznDej4XWnSNhUUxk7MyRzokFylrFYVZ7A+Le9dl+onvNlxC+bAleqI/hl//b99iQ== X-Received: by 2002:a05:600c:4f48:b0:411:c3d3:94dd with SMTP id m8-20020a05600c4f4800b00411c3d394ddmr2667896wmq.28.1707943881789; Wed, 14 Feb 2024 12:51:21 -0800 (PST) Received: from localhost (dslb-002-202-118-224.002.202.pools.vodafone-ip.de. [2.202.118.224]) by smtp.gmail.com with UTF8SMTPSA id jl24-20020a05600c6a9800b00410ac2d6b40sm2931135wmb.8.2024.02.14.12.51.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Feb 2024 12:51:21 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, linux-lvm@lists.linux.dev, Zdenek Kabelac , Peter Rajnoha , Martin Wilck Subject: [PATCH v3 6/6] 11-dm-mpath.rules: Don't force activation while device is suspended Date: Wed, 14 Feb 2024 21:51:07 +0100 Message-ID: <20240214205107.27409-7-mwilck@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214205107.27409-1-mwilck@suse.com> References: <20240214205107.27409-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If paths become available while the device is suspended, don't activate. Another uevent will arrive when the device is resumed. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipath/11-dm-mpath.rules.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index 82b0204..d364f9b 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -94,10 +94,16 @@ ENV{MPATH_DEVICE_READY}=="0", ENV{DM_NOSCAN}="1" ENV{MPATH_DEVICE_READY}=="0", \ ENV{.MPATH_SAVE_DISABLE_OTHER_RULES_FLAG}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}", \ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" + # If the device comes back online, set DM_ACTIVATION so that -# upper layers do a rescan. -ENV{MPATH_DEVICE_READY}!="0", ENV{.MPATH_DEVICE_READY_OLD}=="0", \ - ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0" +# upper layers do a rescan. If the device is currently suspended, +# we have to postpone the activation until the next event. +ENV{MPATH_DEVICE_READY}=="0", GOTO="dont_activate" +ENV{.MPATH_DEVICE_READY_OLD}!="0", GOTO="dont_activate" +ENV{DM_SUSPENDED}=="1", ENV{MPATH_DEVICE_READY}="0", GOTO="dont_activate" + +ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0" +LABEL="dont_activate" # The code to check multipath state ends here. We need to set # properties and symlinks regardless whether the map is usable or