diff mbox series

[v2,6/7] 11-dm-mpath.rules: Don't force activation while device is suspended

Message ID 20240209232735.9791-7-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series udev rule and CI improvements | expand

Commit Message

Martin Wilck Feb. 9, 2024, 11:27 p.m. UTC
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 <mwilck@suse.com>
---
 multipath/11-dm-mpath.rules.in | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Benjamin Marzinski Feb. 10, 2024, 2:38 a.m. UTC | #1
On Sat, Feb 10, 2024 at 12:27:34AM +0100, Martin Wilck wrote:
> 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 <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  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 8e8741a..4141833 100644
> --- a/multipath/11-dm-mpath.rules.in
> +++ b/multipath/11-dm-mpath.rules.in
> @@ -92,10 +92,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
> -- 
> 2.43.0
Martin Wilck Feb. 14, 2024, 8:32 p.m. UTC | #2
On Fri, 2024-02-09 at 21:38 -0500, Benjamin Marzinski wrote:
> On Sat, Feb 10, 2024 at 12:27:34AM +0100, Martin Wilck wrote:
> > 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 <mwilck@suse.com>
> Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> > ---
> >  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 8e8741a..4141833 100644
> > --- a/multipath/11-dm-mpath.rules.in
> > +++ b/multipath/11-dm-mpath.rules.in
> > @@ -92,10 +92,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_DI
> > SABLE_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",

... and it turns out I made a stupid missing-quotes mistake here.

I'll re-post the series, to avoid further confusion.

Martin
diff mbox series

Patch

diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in
index 8e8741a..4141833 100644
--- a/multipath/11-dm-mpath.rules.in
+++ b/multipath/11-dm-mpath.rules.in
@@ -92,10 +92,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