From patchwork Fri Nov 1 21:58:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13859797 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 32E461CDA12 for ; Fri, 1 Nov 2024 21:58:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730498338; cv=none; b=IloV6BJLtVjH3C652z75Xb9ltOautXygCbHM9vZhDauDrUz7QMKO8XFiUpYKp9Cpht58ph5dbF1rccA48LKXRfGHPV+24tc8qFmreXQn3qRGKsQFz+lsipJTiygpNzRRT/twbH9GCxbrxddWwopeGEnjvjOImUIBFsOtOTZtiXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730498338; c=relaxed/simple; bh=y4U9iPrzRx1fmNaDXtpeyk4HL4jw69wuQNInyAWw+Yg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jmPGj29EBrZKlSoefeMVvZWaGR6p2ysEn1e8WxEEgIj9eq+BWeNKcbIEzIsVyNRT8uCK2QoCSWP4ajO4lDrwLPQjSItDh1ix1pjQhR2G4AVVxozzUJVTM14OP0jYP+I5quAxg6Vg5Xu9kGEA/3hhEedq21s1OFydVwVp5jL53AM= 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=VCkZwOwB; arc=none smtp.client-ip=209.85.208.47 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="VCkZwOwB" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5c9709c9b0cso3524162a12.1 for ; Fri, 01 Nov 2024 14:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1730498332; x=1731103132; 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=1Fo6mER/MrdLTL8ecoNmszLXLw94Lvyub5gjrXUN81Y=; b=VCkZwOwBMmgLKSH5ZYt4JKjh0gis/vnK85IWyEKfi58YdCnfXDe3wZm1ctt8cGWnkH 5Mol1OhroLWSwLnbZEip+DuxJrAZy4snbIa5IZUX8Hlh1FldxFevxOQr5ga1L/AVyVCD a07BtpOFzer0pAedOmzoNZNmrOmkvLnVsQNmwOKkqjSru+S5XvUP/qO+pjKqk8LKjfxc O6iVqohKnAxRNtJJAJMYsJf2FuMQ3zLN/eBb+zh4BPMyl7yDDUSTIiQgyksuK1qAWAvl 0oWYbFwx2c+8TxrL9QAFf1UNmKyJSvdoQPGW/w8vmzl+ugAuYkV+LqlDOTIcFRawRFDF xlSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730498332; x=1731103132; 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=1Fo6mER/MrdLTL8ecoNmszLXLw94Lvyub5gjrXUN81Y=; b=SZDJSzEybKHspCRsTgARcPuERsfgDxG8lLKrQif7Fa4wBPkBwxPLq9Hr81MXtzzaZu faT3kBTo/HS+pJjsr9LXBn7Co+sjEuRtW1+JlVCsztATOi9gVZE48fIT86XG2pSNc04J B/WqoFYUtlJ3vYa/IKIESLjL2eZ5X9Ci+O8B6HoRNIbQDKPqrXnDIGSfggme1MZKLonT lppuiyBt5XDpYnlPdg/rVwhWUPxtHKnW3x/Rze0Sk2pBJQ8rbXquZZogr+b+pRdUKzBe dczxT1nrm/KNmNasz0SAAo6WXxQBOXAWaXofR1SgR3H3V7I9eu5eGwry2eF323HxVyTZ Sv9g== X-Forwarded-Encrypted: i=1; AJvYcCXQ45Ds2yhWvOIanz4T2qWloKL+iavLzghS1H3VcGsQVcxArm5BuH7RneJ9Rphy8CCs/MmYjTfcPA==@lists.linux.dev X-Gm-Message-State: AOJu0YyjlxT1R5Po5ljCzLWRnUlhaj+ozr0wBt25towql7FBrbZstw42 yxu9+fN3Bo4DSLWphol/C3JtGW3Xfc4RSjoqpugGYL1075zc2yt9g9O3zijOewg= X-Google-Smtp-Source: AGHT+IFUGpHDKGSj5vhQdjtJyEPpoogU+MYDI0jZjZ29dgkDcg4rR8EGUnb4qIElYFdgZaWVtXFaTQ== X-Received: by 2002:a05:6402:d05:b0:5c9:6fc1:6177 with SMTP id 4fb4d7f45d1cf-5cd54a84c8fmr9025746a12.11.1730498331935; Fri, 01 Nov 2024 14:58:51 -0700 (PDT) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-5ceac7c8d9fsm1934210a12.77.2024.11.01.14.58.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Nov 2024 14:58:51 -0700 (PDT) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: Martin Wilck , dm-devel@lists.linux.dev Subject: [PATCH 1/3] 11-dm-mpath.rules.in: import DM_COLDPLUG_SUSPENDED only once Date: Fri, 1 Nov 2024 22:58:38 +0100 Message-ID: <20241101215840.1077082-2-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241101215840.1077082-1-mwilck@suse.com> References: <20241101215840.1077082-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 import DM_COLDPLUG_SUSPENDED in all code flows below mpath_coldplug_end. Clarify this in the code. Signed-off-by: Martin Wilck --- multipath/11-dm-mpath.rules.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index 30647b9..6783826 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -24,12 +24,13 @@ ENV{DM_UDEV_RULES_VSN}=="1|2", ENV{.DM_SUSPENDED}!="1", ENV{DISK_RO}!="1", \ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="", GOTO="scan_import" LABEL="mpath_coldplug_end" +IMPORT{db}="DM_COLDPLUG_SUSPENDED" + # If this uevent didn't come from dm, don't try to update the # device state # Note that .MPATH_DEVICE_READY_OLD=="" here. Thus we won't activate the # device below at mpath_is_ready, which is correct. ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", \ - IMPORT{db}="DM_COLDPLUG_SUSPENDED", \ GOTO="check_mpath_ready" ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}" @@ -67,7 +68,6 @@ LABEL="check_mpath_unchanged" # 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="@SYSDIR_BIN@/logger -t 11-dm-mpath.rules -p daemon.notice \"Forcing activation of previously suspended device\"", \ From patchwork Fri Nov 1 21:58:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13859796 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.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 518771E2829 for ; Fri, 1 Nov 2024 21:58:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730498337; cv=none; b=eq5MITGRPSRvLk8GJXG93pcKJ0CwH7ZC5JsxR5gsRJF8uIwpo+BKJq36QMes7BFGG3BTvfvw2k7sRn6iF+9W4O0H7Yv3zkL3fgVU5QtX15jmQR0mCSn0ifKg8jKQ6A01rtxTsjsPY4lZ+6tXbKapqc9XetDqZzET1ilgAGIKOl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730498337; c=relaxed/simple; bh=CZAssxSjpM2GC0gMgeX98EciswnZgtt3y1xEBcaEJxI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fbPXSyoKmdvQGq2uSKdBKCzj7EkKME+Cf0O9LxHRFoZ3kjvG8EjsQ6zaoAun3wVZ2ghElGnoIhap7jBvOEI77t8gEotmCCqPER+BNW0falY0RLBKCqDE/Hkmm3k9+EhoYP/tEexAo8iKhiyfelFZou5bhsNvbx8FbpUC4Cd2yuE= 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=XMA6pg8Y; arc=none smtp.client-ip=209.85.208.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="XMA6pg8Y" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5c903f5bd0eso4024735a12.3 for ; Fri, 01 Nov 2024 14:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1730498334; x=1731103134; 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=2DacYKzLolIBI+9tOo5qeyNYiB38EUO8vuHt/ehdxbA=; b=XMA6pg8Yy9E8S52Q383qj7GwikRAINreS/JGriryYQYUU2y71jVRt2mpEFEHmXNa0b Qu0wcSZPjcGsUSlqbijJGmzmuCU807dWXYjUROyfe9YaqaBxdG0MBtJKRCT0zCpnlmw/ bLmNGLUTYmj4+GE8rjpvOyX+aATJsR9T6Dm7DGVhisP5kfZIG7VLcl0A0uuHenmyIy1P Vq6wDFQM36aUcKycUALNZjZ8Ie+cREnnWPZuamjHqL7GSCQk+IcmAPdkrPQGGjL7log6 u9vI+zKmpzKAOQURGrMBC/Uyn9bzUY0vqxXenyXuLoYbOaYjz0xZJP2GjZs5cr9papuz Q4bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730498334; x=1731103134; 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=2DacYKzLolIBI+9tOo5qeyNYiB38EUO8vuHt/ehdxbA=; b=VwjwGyXx8xxblMTBGAUuLDBz0Dw/CvhaD6dJzJwqIgr2kduORwl/o38xglBrMw7Fi8 Ls+aNsIbkI0iYXqdcuwFW2yfjIBGcHkTWtKiJ8WJozOr/tv8Y1+I0GvNikXyqoMkSPAm tDAS7imHKK/q+s+5MHpaVm+xlvXxRBb6qgBIoQ83BTcG6HQu6OT6hVjjFYRxqWzzbJZm Wti+cKAPwHVmNYLloKif0rfyLWhMj8wF27PIS+F0UVsCU7A2JSRJxH2MvlPoqaygSxqU opAidgQ/1gV+U0LpnEabD5beIxxRaAJilUkMZKvbno2ymUPIidUv4fTEi9edk/ud/+OT KsPw== X-Forwarded-Encrypted: i=1; AJvYcCXfIyPCJQ5SitIcFsJFL7mIQFVWIU87Zjt+cl5CN5SPukJkBWZeqx9O73BpKRvJRrzkDc5CkCXBJQ==@lists.linux.dev X-Gm-Message-State: AOJu0Yy6xYgsOmd5wpXNVtDKNS7oIDqCrF9wYmG/7Ij/4pKBA3nw6jmv nk0ysCx/LHz9JNfAUyzxUqiWy8xbOqUYIpTO5kZfX+ShhmDpATVrIcvtMtemr1A= X-Google-Smtp-Source: AGHT+IGgtQOM59v1V5abYfy9pWBT6wPuETdnCk6MAMxbvc9nywb8PX7GDhNAxfQuJMpTgSVMpakFbQ== X-Received: by 2002:a17:907:7e84:b0:a9a:123d:3f1a with SMTP id a640c23a62f3a-a9e508d4af3mr725973166b.17.1730498333432; Fri, 01 Nov 2024 14:58:53 -0700 (PDT) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-a9e56494295sm236538566b.14.2024.11.01.14.58.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Nov 2024 14:58:52 -0700 (PDT) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: Martin Wilck , dm-devel@lists.linux.dev Subject: [PATCH 2/3] 11-dm-mpath.rules.in: handle inactive suspended devices correctly Date: Fri, 1 Nov 2024 22:58:39 +0100 Message-ID: <20241101215840.1077082-3-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241101215840.1077082-1-mwilck@suse.com> References: <20241101215840.1077082-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since b22c273 ("11-dm-mpath.rules: Don't force activation while device is suspended"), we've handled the case where a device is suspended while an uevent is processed (e.g. because multipathd is reloading the map again at the same time). But we were missing the case where The device had never been initialized before. If .MPATH_DEVICE_READY_OLD was empty, we'd jump to scan_import without setting MPATH_DEVICE_READY to 0. This can cause a device not to be fully activated at boot time, because in follow-up uevents we'd assume that the device had already been set up. Treat the case in which an uevent is processed for a previously not fully set-up, suspended device like other situations where we set MPATH_DEVICE_READY to 0. Fixes: b22c273 ("11-dm-mpath.rules: Don't force activation while device is suspended") --- multipath/11-dm-mpath.rules.in | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index 6783826..20f8c6a 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -35,6 +35,13 @@ ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", \ ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}" +# If the device wasn't ready previously and is currently suspended, +# we have to postpone the activation until the next event. +# In this case, we have to set MPATH_DEVICE_READY=0; otherwise, the +# MPATH_UNCHANGED logic will cause later rules to skipped in the next event. +ENV{.MPATH_DEVICE_READY_OLD}!="1", ENV{.DM_SUSPENDED}=="1", \ + ENV{MPATH_DEVICE_READY}="0", GOTO="check_mpath_unchanged" + # multipath sets DM_SUBSYSTEM_UDEV_FLAG2 when it reloads a # table with no active devices. If this happens, mark the # device not ready @@ -106,14 +113,10 @@ GOTO="scan_import" LABEL="mpath_is_ready" # If the device comes back online, set DM_ACTIVATION so that -# upper layers do a rescan. If the device is currently suspended, -# we have to postpone the activation until the next event. -# In this case, we have to set MPATH_DEVICE_READY=0; otherwise, the -# MPATH_UNCHANGED logic will cause later rules to skipped in the next event. -ENV{.MPATH_DEVICE_READY_OLD}!="0", GOTO="scan_import" -ENV{.DM_SUSPENDED}=="1", ENV{MPATH_DEVICE_READY}="0", GOTO="scan_import" - -ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0" +# upper layers will do a rescan. Don't do this if .MPATH_DEVICE_READY_OLD +# is just empty (see comment above the DM_COOKIE test above). +ENV{.MPATH_DEVICE_READY_OLD}=="0", \ + ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0" # The code to check multipath state ends here. We need to set # properties and symlinks regardless whether the map is usable or From patchwork Fri Nov 1 21:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13859798 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.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 A02601E32B4 for ; Fri, 1 Nov 2024 21:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730498338; cv=none; b=UGgy+5XmWJu1bjKDDf0gde2hUqjYP4wnUMQJClTzVmlipBjck1ccyjxvGtz7k+raYt6amyoO31UQ2VeonKpX5m+VOcgdE3bfLbnXNk4mZxJ2Hk/dzrC/Aw3UiWzVRh3jlFHkxu7EOJnkKvYmSAYktHPOpZI+nSUk70tLs1T6cwg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730498338; c=relaxed/simple; bh=NlxzbDUJ7h4re1FQBK6KOnNcEl2PIZ8Pe8AFnYwfBFA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XTQV1/Lujx9TG+mDBJsTVMxsSdXfl+ZSsmvlScB9X5XuCR3fSoVVtAzlTXiS8F7XOkloVqAkUcQ8/v+bPyRuwf2WeGM08jLVgAVHk8H0VxRP/7nIZtAA0ummFCuqHdvteKOWcoy/txLB2AwZSBw0pc95qGJNn3HqQuAP7Rdq5KI= 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=RvYukJCM; arc=none smtp.client-ip=209.85.208.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="RvYukJCM" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5cec9609303so289459a12.1 for ; Fri, 01 Nov 2024 14:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1730498335; x=1731103135; 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=MFda3Nv7nkjalH7wJLPTGB48A68kdy2UdMn+L3x+ICY=; b=RvYukJCM5k/+gFnMLBnPk9jeq2h/4gL3vjNjUmNEYNFLdICqnvZwnBGEjdLNEV/VRy FYgKpCG0Qe6VRIV1oy9DqdC5hRaUrJqDfQa1zrcvmxc+vjbOG9/zBX3GSNWqHz09XwEO ThsoNzUhIfZayYKZ6LL6otv/3VRwL8jaZfc/rLFj1F8HZMplxCX+tACe1jxm8Hi4VJrf Q7BnYC62Ga5uJWX4FkpBMul1HiBGLpMAvg/k68U4E6OFpdS/n1A4rQfOz28qrQGmIsca cx+dQM1PDxPuAguwOIEhPkAI3IHvev8icSAlbEFWQTh1Amkk03Ee8ukW6UAdDoQA+By5 SemQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730498335; x=1731103135; 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=MFda3Nv7nkjalH7wJLPTGB48A68kdy2UdMn+L3x+ICY=; b=f7IqO0kyBBZvmXu7oDIctLmcVSH7dYTlfww70rNM3tEC8U8YhMO12ETYmvMXfxAM4j uJSUasBLYlRIivWAbOUQHzwwtBXb0Vf+QLlR8q3tje9EIYY7ibz3ZQO7S3HkS6sDNYo8 RZyCnHwHYtw8xdXDqDpFPOGOHFP9GNcP8jKB+mAVLWps7PhIGy9F7INgNgPcCHrqs+R9 0b/HeW163U/djpWXcjRf49ula6aFJ9LNhXYpAk3+hiU5Xg9dHqaX2SdzAGaLX28Wi9vi pQwNskzz47/7iq8OXho0VS5W2ns3ab01NsNgPMZgJeXEffC+lnO706TOBi8m0K1QdF/h mT5w== X-Forwarded-Encrypted: i=1; AJvYcCVX75IFwkTIU7nD1xwn3Xg3DiHkR8+mPwCJDfdWAAuWoK2IRgjWdf2ukeNItmgDEjlkL3Hp9V0TOA==@lists.linux.dev X-Gm-Message-State: AOJu0YxD6gZGduKsyMmjAXE1Tj9vq6PgfVHEqDzunNoIugnCh85UHnfB B8xMubaXploI42oFIDSMgv0Njj3Nwog292tK/kpcDR19UIzN63Vbme6JFJ24Rvk= X-Google-Smtp-Source: AGHT+IGOdXCzDyo4I8ygZ3JfPMJ9tV74ocKIdW3h/6aNGVDZTev1/LbCFIQAG29bKvIng0HSJIor/w== X-Received: by 2002:a05:6402:13c9:b0:5c9:6eea:8e06 with SMTP id 4fb4d7f45d1cf-5cbbf947c0cmr20313727a12.24.1730498334683; Fri, 01 Nov 2024 14:58:54 -0700 (PDT) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-5ceac78cebbsm1920833a12.51.2024.11.01.14.58.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Nov 2024 14:58:54 -0700 (PDT) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: Martin Wilck , dm-devel@lists.linux.dev Subject: [PATCH 3/3] 11-dm-mpath.rules.in: clarify DM_ACTIVATION logic Date: Fri, 1 Nov 2024 22:58:40 +0100 Message-ID: <20241101215840.1077082-4-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241101215840.1077082-1-mwilck@suse.com> References: <20241101215840.1077082-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Our code is always setting MPATH_UNCHANGED and DM_ACTIVATION in pairs. While DM_ACTIVATION is a global DM property, MPATH_UNCHANGED is owned by us. Just set MPATH_UNCHANGED, and adapt DM_ACTIVATION when necessary just in one place. Signed-off-by: Martin Wilck --- multipath/11-dm-mpath.rules.in | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in index 20f8c6a..a2655cb 100644 --- a/multipath/11-dm-mpath.rules.in +++ b/multipath/11-dm-mpath.rules.in @@ -74,25 +74,25 @@ LABEL="check_mpath_unchanged" # 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. +# i.e. disable the MPATH_UNCHANGED logic. ENV{DM_COLDPLUG_SUSPENDED}=="1", ENV{.DM_SUSPENDED}!="1", \ - ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0", \ + ENV{MPATH_UNCHANGED}="0", \ PROGRAM="@SYSDIR_BIN@/logger -t 11-dm-mpath.rules -p daemon.notice \"Forcing activation of previously suspended device\"", \ GOTO="check_mpath_ready" # 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 +# Set the MPATH_UNCHANGED flag here as mpath reloads tables if any of its # paths are lost/recovered. For any stack above the mpath device, this is not # something that should be reacted upon since it would be useless extra work. # It's exactly mpath's job to provide *seamless* device access to any of the # paths that are available underneath. ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", \ - ENV{DM_ACTIVATION}="0", ENV{MPATH_UNCHANGED}="1" + ENV{MPATH_UNCHANGED}="1" -# For path failed or reinstated events, unset DM_ACTIVATION. +# For path failed or reinstated events, set MPATH_UNCHANGED. # This is similar to the DM_SUBSYSTEM_UDEV_FLAG0 case above. ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", \ - ENV{DM_ACTIVATION}="0", ENV{MPATH_UNCHANGED}="1" + ENV{MPATH_UNCHANGED}="1" LABEL="check_mpath_ready" @@ -112,11 +112,10 @@ GOTO="scan_import" LABEL="mpath_is_ready" -# If the device comes back online, set DM_ACTIVATION so that +# If the device comes back online, clear MPATH_UNCHANGED so that # upper layers will do a rescan. Don't do this if .MPATH_DEVICE_READY_OLD # is just empty (see comment above the DM_COOKIE test above). -ENV{.MPATH_DEVICE_READY_OLD}=="0", \ - ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0" +ENV{.MPATH_DEVICE_READY_OLD}=="0", ENV{MPATH_UNCHANGED}="0" # The code to check multipath state ends here. We need to set # properties and symlinks regardless whether the map is usable or @@ -146,6 +145,10 @@ IMPORT{db}="ID_PART_GPT_AUTO_ROOT" LABEL="import_end" +# If MPATH_UNCHANGED is set, adapt DM_ACTIVATION. +ENV{MPATH_UNCHANGED}=="0", ENV{DM_ACTIVATION}="1" +ENV{MPATH_UNCHANGED}=="1", ENV{DM_ACTIVATION}="0" + # Reset previous DM_COLDPLUG_SUSPENDED if activation happens now ENV{.DM_SUSPENDED}!="1", ENV{DM_ACTIVATION}=="1", ENV{DM_COLDPLUG_SUSPENDED}=""