[patch] Fix hotplugging startup

Sjoerd Simons sjoerd at luon.net
Wed Sep 29 14:00:15 PDT 2004


Hi,

  The first hotplug events to determine the sequence number seems somewhat
  buggy, causing usb drive detection to fail when it's plugged in after hal
  startup..

  The current code works as follows. When the first hostplug event comes in it's
  set as the last hotplug sequence number and the codes start sleeping for a
  while. Which is nice, because it could be that some earlier hotplug events
  still needs to come in.  Now some code below that special cases the event
  that hotplug events come in which are older then the last and process them
  immediately

  So if the first hotplug events come in in almost reverse order (what seems to
  happen with usb drives), then they are processed in reverse order and things
  start going wrong.

  Just removing the special case code seems ok, but there is a comment that if
  not doing that it could cause deathlocks. Although i don't really see how it
  could cause that (please enlighten me :)).

  Patch attached which removes that code. Please triplecheck before applying :)
    
  Sjoerd
-- 
There is no opinion so absurd that some philosopher will not express it.
		-- Marcus Tullius Cicero, "Ad familiares"
-------------- next part --------------
Index: hald/linux/osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/osspec.c,v
retrieving revision 1.44
diff -u -u -r1.44 osspec.c
--- hald/linux/osspec.c	20 Sep 2004 18:31:15 -0000	1.44
+++ hald/linux/osspec.c	29 Sep 2004 20:40:51 -0000
@@ -1492,20 +1492,6 @@
 			/* so we only setup one timer */
 			last_hotplug_seqnum = msg.seqnum;
 		}
-
-		if (msg.seqnum < last_hotplug_seqnum) {
-			/* yikes, this means were started during a hotplug */
-			HAL_WARNING (("Got SEQNUM=%llu, but last_hotplug_seqnum=%llu", msg.seqnum, last_hotplug_seqnum));
-
-			/* have to process immediately other we may deadlock due to
-			 * the hotplug semaphore */
-			hald_helper_hotplug (msg.action, msg.seqnum, g_strdup (msg.subsystem), 
-					     g_strdup (msg.sysfs_path), &msg);
-			/* still need to process the queue though */
-			hald_helper_hotplug_process_queue ();
-			goto out;
-		}
-
 		/* Queue up this hotplug event and process the queue */
 		HAL_INFO (("Queing up seqnum=%llu, sysfspath=%s, subsys=%s", 
 			   msg.seqnum, msg.sysfs_path, msg.subsystem));
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list