On Sat, Feb 10, 2024 at 12:27:33AM +0100, Martin Wilck wrote: > 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 <mwilck@xxxxxxxx> Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> > --- > 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 e31107b..8e8741a 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_*", IMPORT{db}="DM_NOSCAN", GOTO="scan_import" > -- > 2.43.0