On Mon, Feb 05, 2024 at 01:46:33PM +0100, Martin Wilck wrote:
> DM_UDEV_DISABLE_OTHER_RULES_FLAG and DM_NOSCAN may be already set
> from previous rules, e.g. if the device is suspended. Make sure
> we don't overwrite them.
>
> DM_DISABLE_OTHER_RULES_FLAG_OLD and MPATH_DEVICE_READY are only
> used in this file, and not used in the scan_import code path.
>
> Signed-off-by: Martin Wilck <[email protected]>
> ---
> multipath/11-dm-mpath.rules | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/multipath/11-dm-mpath.rules b/multipath/11-dm-mpath.rules
> index c339f52..2c4d006 100644
> --- a/multipath/11-dm-mpath.rules
> +++ b/multipath/11-dm-mpath.rules
> @@ -2,12 +2,19 @@ ACTION!="add|change", GOTO="mpath_end"
> ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="mpath_end"
> ENV{DM_UUID}!="mpath-?*", GOTO="mpath_end"
>
> -IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD"
> -IMPORT{db}="MPATH_DEVICE_READY"
> -
> # 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_UDEV_DISABLE_OTHER_RULES_FLAG", IMPORT{db}="DM_NOSCAN",
> GOTO="scan_import"
> +ENV{DM_COOKIE}=="?*", GOTO="check_ready"
> +ENV{DM_ACTION}=="PATH_*", GOTO="check_ready"
> +
> +ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="?*",
> IMPORT{db}="DM_UDEV_DISABLE_OTHER_RULES_FLAG"
> +ENV{DM_NOSCAN}!="?*", IMPORT{db}="DM_NOSCAN"
> +GOTO="scan_import"
> +
If we do this, don't we forget the values for
DM_DISABLE_OTHER_RULES_FLAG_OLD and MPATH_DEVICE_READY whenever we get a
non-dm uevent? If we skip importing them for a uevent, they're dropped
from the database, which means that on the next dm-originated uevent we
won't be able to get the old values. right?
-Ben
> +LABEL="check_ready"
> +
> +IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD"
> +IMPORT{db}="MPATH_DEVICE_READY"
>
> ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}"
>
> --
> 2.43.0