All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: device-mapper development <dm-devel@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>, Greg KH <greg@kroah.com>,
	Kay Sievers <kay@redhat.com>
Subject: [PATCH] Reduce number of KOBJ_REMOVE events
Date: Fri, 22 Jul 2011 16:22:38 +0200	[thread overview]
Message-ID: <4E2987AE.2070707@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: kobj_remove.patch --]
[-- Type: text/x-patch, Size: 3584 bytes --]

Author: Zdenek Kabelac <zkabelac@redhat.com>
Date:   Fri Jul 22 15:02:17 2011 +0200

Reduce number of KOBJ_REMOVE events

For now udev recieves 3 event for removal of DM logical volumes. (1 for
bdi and 2 for same block kobject). Reason is dm device generates its
own kobject event with approriate env parameter and block layer sends
another KOBJ_REMOVE event on its own unconditionaly for the same
kobject. As for now only the kobject cleanup checks that the REMOVE
event has been already sent and avoids duplicate REMOVE event.

The patch for kobject_uevent_env() which has been testing for duplicate
REMOVE event did not passed into the mainline (yet?):

https://www.redhat.com/archives/dm-devel/2010-March/msg00107.html 

I'm proposing alternative way around to always use kobject cleanup
routine for sending REMOVE event if it was not send by the module - so
it makes the code few lines shorter.

This patch removes single appearencies of kobject_uevent() prior
kobject removal.

Signed-off-by:  Zdenek Kabelac <zkabelac@redhat.com>

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 129b9e2..431f401 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -439,7 +439,6 @@ void blk_integrity_unregister(struct gendisk *disk)
 
 	bi = disk->integrity;
 
-	kobject_uevent(&bi->kobj, KOBJ_REMOVE);
 	kobject_del(&bi->kobj);
 	kobject_put(&bi->kobj);
 	disk->integrity = NULL;
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index d935bd8..a50472d 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -521,7 +521,6 @@ int blk_register_queue(struct gendisk *disk)
 
 	ret = elv_register_queue(q);
 	if (ret) {
-		kobject_uevent(&q->kobj, KOBJ_REMOVE);
 		kobject_del(&q->kobj);
 		blk_trace_remove_sysfs(dev);
 		kobject_put(&dev->kobj);
@@ -541,7 +540,6 @@ void blk_unregister_queue(struct gendisk *disk)
 	if (q->request_fn)
 		elv_unregister_queue(q);
 
-	kobject_uevent(&q->kobj, KOBJ_REMOVE);
 	kobject_del(&q->kobj);
 	blk_trace_remove_sysfs(disk_to_dev(disk));
 	kobject_put(&disk_to_dev(disk)->kobj);
diff --git a/block/elevator.c b/block/elevator.c
index b0b38ce..a8d912b 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -892,7 +892,6 @@ EXPORT_SYMBOL(elv_register_queue);
 
 static void __elv_unregister_queue(struct elevator_queue *e)
 {
-	kobject_uevent(&e->kobj, KOBJ_REMOVE);
 	kobject_del(&e->kobj);
 	e->registered = 0;
 }
diff --git a/drivers/base/core.c b/drivers/base/core.c
index bc8729d..8c9af0d 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1013,7 +1013,6 @@ done:
  ueventattrError:
 	device_remove_file(dev, &uevent_attr);
  attrError:
-	kobject_uevent(&dev->kobj, KOBJ_REMOVE);
 	kobject_del(&dev->kobj);
  Error:
 	cleanup_device_parent(dev);
@@ -1132,7 +1131,6 @@ void device_del(struct device *dev)
 	 */
 	if (platform_notify_remove)
 		platform_notify_remove(dev);
-	kobject_uevent(&dev->kobj, KOBJ_REMOVE);
 	cleanup_device_parent(dev);
 	kobject_del(&dev->kobj);
 	put_device(parent);
diff --git a/mm/slub.c b/mm/slub.c
index 35f351f..3c77956 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4720,7 +4720,6 @@ static void sysfs_slab_remove(struct kmem_cache *s)
 		 */
 		return;
 
-	kobject_uevent(&s->kobj, KOBJ_REMOVE);
 	kobject_del(&s->kobj);
 	kobject_put(&s->kobj);
 }
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 1bacca4..f20a945 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -153,7 +153,6 @@ static void del_nbp(struct net_bridge_port *p)
 
 	br_multicast_del_port(p);
 
-	kobject_uevent(&p->kobj, KOBJ_REMOVE);
 	kobject_del(&p->kobj);
 
 	br_netpoll_disable(p);

             reply	other threads:[~2011-07-22 14:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 14:22 Zdenek Kabelac [this message]
2011-07-25  0:18 ` [PATCH] Reduce number of KOBJ_REMOVE events Kay Sievers
2011-07-25 10:12   ` [dm-devel] " Zdenek Kabelac
2011-07-25 12:17     ` Kay Sievers
2011-07-25 12:54       ` Zdenek Kabelac
2011-07-25 14:22         ` Kay Sievers
2011-07-26 15:48           ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E2987AE.2070707@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=greg@kroah.com \
    --cc=kay@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.