From: tang.junhui <tang.junhui@xxxxxxxxxx> Move calling filter_devnode() from uev_trigger() to uevent_can_discard() since they do the similar work. Change-Id: I0322443fa551b21aa3211bf1ce3fad7d37aeeab4 Signed-off-by: tang.junhui <tang.junhui@xxxxxxxxxx> --- libmultipath/uevent.c | 25 +++++++++++++++++++++++-- multipathd/main.c | 9 --------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c index ac49cac..cc10d65 100644 --- a/libmultipath/uevent.c +++ b/libmultipath/uevent.c @@ -47,6 +47,9 @@ #include "list.h" #include "uevent.h" #include "vector.h" +#include "structs.h" +#include "config.h" +#include "blacklist.h" typedef int (uev_trigger)(struct uevent *, void * trigger_data); @@ -82,10 +85,11 @@ struct uevent * alloc_uevent (void) } bool -uevent_can_discard(char *devpath) +uevent_can_discard(char *devpath, char *kernel) { char *tmp; char a[11], b[11]; + struct config * conf; /* * keep only block devices, discard partitions @@ -100,6 +104,23 @@ uevent_can_discard(char *devpath) condlog(4, "discard event on %s", devpath); return true; } + + /* + * do not filter dm devices by devnode + */ + if (!strncmp(kernel, "dm-", 3)) + return false; + /* + * filter paths devices by devnode + */ + conf = get_multipath_config(); + if (filter_devnode(conf->blist_devnode, conf->elist_devnode, + kernel) > 0) { + put_multipath_config(conf); + return true; + } + put_multipath_config(conf); + return false; } @@ -550,7 +571,7 @@ int uevent_listen(struct udev *udev) uev = uevent_from_udev_device(dev); if (!uev) continue; - if (uevent_can_discard(uev->devpath)) { + if (uevent_can_discard(uev->devpath, uev->kernel)) { udev_device_unref(uev->udev); FREE(uev); continue; diff --git a/multipathd/main.c b/multipathd/main.c index 51f7b60..15a6175 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1092,7 +1092,6 @@ uev_trigger (struct uevent * uev, void * trigger_data) { int r = 0; struct vectors * vecs; - struct config *conf; vecs = (struct vectors *)trigger_data; @@ -1126,14 +1125,6 @@ uev_trigger (struct uevent * uev, void * trigger_data) /* * path add/remove event */ - conf = get_multipath_config(); - if (filter_devnode(conf->blist_devnode, conf->elist_devnode, - uev->kernel) > 0) { - put_multipath_config(conf); - goto out; - } - put_multipath_config(conf); - if (!strncmp(uev->action, "add", 3)) { r = uev_add_path(uev, vecs, 1); goto out; -- 2.8.1.windows.1 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel