If the KOBJ_REMOVE was sent already there is no need to send it again. One example is when device-mapper device send explicit REMOVE event with additional DM environment values (cookie) when mapping table is being destroyed (device is unusable after that) and underlying block device sends another REMOVE event unconditionally in its destructor. Signed-off-by: Milan Broz <mbroz@xxxxxxxxxx> --- lib/kobject_uevent.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index c9d3a3e..c7881bd 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -125,6 +125,15 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, kobject_name(kobj), kobj, __func__); return 0; } + + /* skip remove event, if already sent*/ + if (action == KOBJ_REMOVE && kobj->state_remove_uevent_sent) { + pr_debug("kobject: '%s' (%p): %s: ignoring " + "already sent remove event!\n", + kobject_name(kobj), kobj, __func__); + return 0; + } + /* skip the event, if the filter returns zero. */ if (uevent_ops && uevent_ops->filter) if (!uevent_ops->filter(kset, kobj)) { -- 1.7.0 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel