@@ -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;
@@ -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;