diff mbox series

[10/11] 11-dm-mpath.rules: make label names more intuitive

Message ID 20240324211301.7200-11-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath udev rules changes for dm rules V3 | expand

Commit Message

Martin Wilck March 24, 2024, 9:13 p.m. UTC
The labels "dont_activate" and "scan_import" denote the same code line.
Remove "dont_activate". Improve two misleading label names.

Substitutions:
   dont_activate -> scan_import
   force_activation -> check_mpath_ready
   mpath_action -> check_mpath_unchanged

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 multipath/11-dm-mpath.rules.in | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Comments

Benjamin Marzinski March 27, 2024, 12:06 a.m. UTC | #1
On Sun, Mar 24, 2024 at 10:13:00PM +0100, Martin Wilck wrote:
> The labels "dont_activate" and "scan_import" denote the same code line.
> Remove "dont_activate". Improve two misleading label names.
> 
> Substitutions:
>    dont_activate -> scan_import
>    force_activation -> check_mpath_ready
>    mpath_action -> check_mpath_unchanged
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  multipath/11-dm-mpath.rules.in | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in
> index 2285853..526cca8 100644
> --- a/multipath/11-dm-mpath.rules.in
> +++ b/multipath/11-dm-mpath.rules.in
> @@ -30,7 +30,7 @@ LABEL="mpath_coldplug_end"
>  # device below at mpath_is_ready, which is correct.
>  ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", \
>  	IMPORT{db}="DM_COLDPLUG_SUSPENDED", \
> -	GOTO="force_activation"
> +	GOTO="check_mpath_ready"
>  
>  ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}"
>  
> @@ -38,13 +38,13 @@ ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}"
>  # table with no active devices. If this happens, mark the
>  # device not ready
>  ENV{DM_SUBSYSTEM_UDEV_FLAG2}=="1", ENV{MPATH_DEVICE_READY}="0", \
> -	GOTO="mpath_action"
> +	GOTO="check_mpath_unchanged"
>  
>  # If the last path has failed mark the device not ready
>  # Note that DM_NR_VALID_PATHS is only set for PATH_FAILED|PATH_REINSTATED
>  # events.
>  # This may not be reliable, as events aren't necessarily received in order.
> -ENV{DM_NR_VALID_PATHS}=="0", ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
> +ENV{DM_NR_VALID_PATHS}=="0", ENV{MPATH_DEVICE_READY}="0", GOTO="check_mpath_unchanged"
>  
>  # Don't run multipath -U during "coldplug" after switching root,
>  # because paths are just being added to the udev db.
> @@ -53,7 +53,8 @@ ACTION=="add", ENV{.MPATH_DEVICE_READY_OLD}=="1", GOTO="paths_ok"
>  # Check the map state directly with multipath -U.
>  # This doesn't attempt I/O on the device.
>  PROGRAM=="@BINDIR@/multipath -U -v1 %k", GOTO="paths_ok"
> -ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
> +ENV{MPATH_DEVICE_READY}="0", GOTO="check_mpath_unchanged"
> +
>  LABEL="paths_ok"
>  
>  # For PATH_FAILED events, keep the existing value of MPATH_DEVICE_READY.
> @@ -61,7 +62,7 @@ LABEL="paths_ok"
>  # table reload where there are active paths. Mark the device ready.
>  ENV{DM_ACTION}!="PATH_FAILED", ENV{MPATH_DEVICE_READY}="1"
>  
> -LABEL="mpath_action"
> +LABEL="check_mpath_unchanged"
>  
>  # A previous coldplug event occurred while the device was suspended.
>  # Activation might have been partially skipped. Activate the device now,
> @@ -70,7 +71,7 @@ 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"
> +	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
> @@ -86,7 +87,7 @@ ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", \
>  ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", \
>  	ENV{DM_ACTIVATION}="0", ENV{MPATH_UNCHANGED}="1"
>  
> -LABEL="force_activation"
> +LABEL="check_mpath_ready"
>  
>  ENV{MPATH_DEVICE_READY}!="0", GOTO="mpath_is_ready"
>  # Do not initiate scanning if no path is available,
> @@ -100,18 +101,17 @@ ENV{MPATH_DEVICE_READY}!="0", GOTO="mpath_is_ready"
>  ENV{DM_UDEV_RULES_VSN}!="3",
>  	ENV{.MPATH_SAVE_DISABLE_OTHER_RULES_FLAG}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}"
>  ENV{.DM_NOSCAN}="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
> -GOTO="dont_activate"
> +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.
> -ENV{.MPATH_DEVICE_READY_OLD}!="0", GOTO="dont_activate"
> -ENV{.DM_SUSPENDED}=="1", GOTO="dont_activate"
> +ENV{.MPATH_DEVICE_READY_OLD}!="0", GOTO="scan_import"
> +ENV{.DM_SUSPENDED}=="1", GOTO="scan_import"
>  
>  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
> -- 
> 2.43.2
diff mbox series

Patch

diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in
index 2285853..526cca8 100644
--- a/multipath/11-dm-mpath.rules.in
+++ b/multipath/11-dm-mpath.rules.in
@@ -30,7 +30,7 @@  LABEL="mpath_coldplug_end"
 # device below at mpath_is_ready, which is correct.
 ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", \
 	IMPORT{db}="DM_COLDPLUG_SUSPENDED", \
-	GOTO="force_activation"
+	GOTO="check_mpath_ready"
 
 ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}"
 
@@ -38,13 +38,13 @@  ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}"
 # table with no active devices. If this happens, mark the
 # device not ready
 ENV{DM_SUBSYSTEM_UDEV_FLAG2}=="1", ENV{MPATH_DEVICE_READY}="0", \
-	GOTO="mpath_action"
+	GOTO="check_mpath_unchanged"
 
 # If the last path has failed mark the device not ready
 # Note that DM_NR_VALID_PATHS is only set for PATH_FAILED|PATH_REINSTATED
 # events.
 # This may not be reliable, as events aren't necessarily received in order.
-ENV{DM_NR_VALID_PATHS}=="0", ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
+ENV{DM_NR_VALID_PATHS}=="0", ENV{MPATH_DEVICE_READY}="0", GOTO="check_mpath_unchanged"
 
 # Don't run multipath -U during "coldplug" after switching root,
 # because paths are just being added to the udev db.
@@ -53,7 +53,8 @@  ACTION=="add", ENV{.MPATH_DEVICE_READY_OLD}=="1", GOTO="paths_ok"
 # Check the map state directly with multipath -U.
 # This doesn't attempt I/O on the device.
 PROGRAM=="@BINDIR@/multipath -U -v1 %k", GOTO="paths_ok"
-ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
+ENV{MPATH_DEVICE_READY}="0", GOTO="check_mpath_unchanged"
+
 LABEL="paths_ok"
 
 # For PATH_FAILED events, keep the existing value of MPATH_DEVICE_READY.
@@ -61,7 +62,7 @@  LABEL="paths_ok"
 # table reload where there are active paths. Mark the device ready.
 ENV{DM_ACTION}!="PATH_FAILED", ENV{MPATH_DEVICE_READY}="1"
 
-LABEL="mpath_action"
+LABEL="check_mpath_unchanged"
 
 # A previous coldplug event occurred while the device was suspended.
 # Activation might have been partially skipped. Activate the device now,
@@ -70,7 +71,7 @@  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"
+	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
@@ -86,7 +87,7 @@  ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", \
 ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", \
 	ENV{DM_ACTIVATION}="0", ENV{MPATH_UNCHANGED}="1"
 
-LABEL="force_activation"
+LABEL="check_mpath_ready"
 
 ENV{MPATH_DEVICE_READY}!="0", GOTO="mpath_is_ready"
 # Do not initiate scanning if no path is available,
@@ -100,18 +101,17 @@  ENV{MPATH_DEVICE_READY}!="0", GOTO="mpath_is_ready"
 ENV{DM_UDEV_RULES_VSN}!="3",
 	ENV{.MPATH_SAVE_DISABLE_OTHER_RULES_FLAG}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}"
 ENV{.DM_NOSCAN}="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
-GOTO="dont_activate"
+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.
-ENV{.MPATH_DEVICE_READY_OLD}!="0", GOTO="dont_activate"
-ENV{.DM_SUSPENDED}=="1", GOTO="dont_activate"
+ENV{.MPATH_DEVICE_READY_OLD}!="0", GOTO="scan_import"
+ENV{.DM_SUSPENDED}=="1", GOTO="scan_import"
 
 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