diff mbox

[v2,06/20] libmultipath: trigger path uevent only when necessary

Message ID 20180319150155.5363-7-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Martin Wilck March 19, 2018, 3:01 p.m. UTC
Paths that are already classified as DM_MULTIPATH_DEVICE_PATH don't
need to be retriggered.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/configure.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Benjamin Marzinski March 23, 2018, 5:58 p.m. UTC | #1
On Mon, Mar 19, 2018 at 04:01:41PM +0100, Martin Wilck wrote:
> Paths that are already classified as DM_MULTIPATH_DEVICE_PATH don't
> need to be retriggered.
> 
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  libmultipath/configure.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/libmultipath/configure.c b/libmultipath/configure.c
> index 245bd11672cb..838d145a5aa2 100644
> --- a/libmultipath/configure.c
> +++ b/libmultipath/configure.c
> @@ -456,8 +456,20 @@ trigger_paths_udev_change(const struct multipath *mpp)
>  		if (!pgp->paths)
>  			continue;
>  		vector_foreach_slot(pgp->paths, pp, j) {
> +			const char *env;
> +
>  			if (!pp->udev)
>  				continue;
> +			/*
> +			 * Paths that are already classified as multipath
> +			 * members don't need another uevent.
> +			 */
> +			env = udev_device_get_property_value(
> +				pp->udev, "DM_MULTIPATH_DEVICE_PATH");
> +			if (env != NULL && !strcmp(env, "1"))
> +					continue;
> +
> +			condlog(4, "triggering change uevent for %s", pp->dev);
>  			sysfs_attr_set_value(pp->udev, "uevent", "change",
>  					     strlen("change"));
>  		}
> -- 
> 2.16.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 245bd11672cb..838d145a5aa2 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -456,8 +456,20 @@  trigger_paths_udev_change(const struct multipath *mpp)
 		if (!pgp->paths)
 			continue;
 		vector_foreach_slot(pgp->paths, pp, j) {
+			const char *env;
+
 			if (!pp->udev)
 				continue;
+			/*
+			 * Paths that are already classified as multipath
+			 * members don't need another uevent.
+			 */
+			env = udev_device_get_property_value(
+				pp->udev, "DM_MULTIPATH_DEVICE_PATH");
+			if (env != NULL && !strcmp(env, "1"))
+					continue;
+
+			condlog(4, "triggering change uevent for %s", pp->dev);
 			sysfs_attr_set_value(pp->udev, "uevent", "change",
 					     strlen("change"));
 		}