On Sun, Mar 24, 2024 at 10:12:54PM +0100, Martin Wilck wrote: > With the late patches for 10-dm.rules, DM_UDEV_DISABLE_OTHER_RULES_FLAG isn't > restored from the udev database any more, so we don't need to restore > the flag to its original state before it is saved to the db. > > Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> > --- > multipath/11-dm-mpath.rules.in | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/multipath/11-dm-mpath.rules.in b/multipath/11-dm-mpath.rules.in > index 5259b86..997e3e7 100644 > --- a/multipath/11-dm-mpath.rules.in > +++ b/multipath/11-dm-mpath.rules.in > @@ -84,23 +84,25 @@ ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", \ > > LABEL="force_activation" > > +ENV{MPATH_DEVICE_READY}!="0", GOTO="mpath_is_ready" > # 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. > -ENV{MPATH_DEVICE_READY}=="0", ENV{DM_NOSCAN}="1" > - > -# Skip all foreign rules if no path is available. > +# This is communicated to later rules in DM_NOSCAN. > +# Likewise, 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" > +# to upper layers. With dm rules < v3, save the original value here; > +# it will be restored in a late udev rule. > +ENV{DM_UDEV_RULES_VSN}!="3", Can't we do something like: ENV{DM_UDEV_RULES_VSN}=="1|2", instead, that wouldn't break on future version number bumps. > + 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" > + > +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}=="0", GOTO="dont_activate" > ENV{.MPATH_DEVICE_READY_OLD}!="0", GOTO="dont_activate" > ENV{DM_SUSPENDED}=="1", GOTO="dont_activate" > > -- > 2.43.2