Re: two lock order reversals

2002-04-03 Thread Steve Kargl

I apparently responded to Jonathan via private email.
The patch below fixes the eventhandler lock ordering
problem.

steve

On Tue, Apr 02, 2002 at 06:25:40PM -0800, Jonathan Mini wrote:
 Steven G. Kargl [[EMAIL PROTECTED]] wrote :
 
 lock order reversal
  1st 0xc02d9b40 eventhandler @ /usr/src/sys/kern/subr_eventhandler.c:163
  2nd 0xc4050008 shutdown_post_sync @ /usr/src/sys/kern/subr_eventhandler.c:116
 
   [ ... ]
 
 I believe the second is known, but the first appears
 to be related to the recent eventhandler locking.
 
 Sorry about that.
 
 Index: kern/subr_eventhandler.c
 ===
 RCS file: /usr/cvs/src/sys/kern/subr_eventhandler.c,v
 retrieving revision 1.16
 diff -u -r1.16 subr_eventhandler.c
 --- sys/kern/subr_eventhandler.c  2 Apr 2002 04:18:54 -   1.16
 +++ sys/kern/subr_eventhandler.c  3 Apr 2002 02:21:29 -
 @@ -101,11 +101,11 @@
   sx_init(list-el_lock, name);
   list-el_flags = EHE_INITTED;
  }
 +mtx_unlock(eventhandler_mutex);
  
  /* allocate an entry for this handler, populate it */
  if ((eg = malloc(sizeof(struct eventhandler_entry_generic), 
M_EVENTHANDLER, M_NOWAIT)) == NULL) {
 - mtx_unlock(eventhandler_mutex);
   return(NULL);
  }
  eg-func = func;
 @@ -125,7 +125,6 @@
  if (ep == NULL)
   TAILQ_INSERT_TAIL(list-el_entries, eg-ee, ee_link);
  EHE_UNLOCK(list);
 -mtx_unlock(eventhandler_mutex);
  return(eg-ee);
  }
  
 
 -- 
 Jonathan Mini
 [EMAIL PROTECTED]
 
 baka^ni desolation... despair... plastic forks...
 
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-current in the body of the message

-- 
Steve

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: two lock order reversals

2002-04-02 Thread Jonathan Mini

Steven G. Kargl [[EMAIL PROTECTED]] wrote :

 lock order reversal
  1st 0xc02d9b40 eventhandler @ /usr/src/sys/kern/subr_eventhandler.c:163
  2nd 0xc4050008 shutdown_post_sync @ /usr/src/sys/kern/subr_eventhandler.c:116

  [ ... ]

 I believe the second is known, but the first appears
 to be related to the recent eventhandler locking.

Sorry about that.

Index: kern/subr_eventhandler.c
===
RCS file: /usr/cvs/src/sys/kern/subr_eventhandler.c,v
retrieving revision 1.16
diff -u -r1.16 subr_eventhandler.c
--- sys/kern/subr_eventhandler.c2 Apr 2002 04:18:54 -   1.16
+++ sys/kern/subr_eventhandler.c3 Apr 2002 02:21:29 -
@@ -101,11 +101,11 @@
sx_init(list-el_lock, name);
list-el_flags = EHE_INITTED;
 }
+mtx_unlock(eventhandler_mutex);
 
 /* allocate an entry for this handler, populate it */
 if ((eg = malloc(sizeof(struct eventhandler_entry_generic), 
 M_EVENTHANDLER, M_NOWAIT)) == NULL) {
-   mtx_unlock(eventhandler_mutex);
return(NULL);
 }
 eg-func = func;
@@ -125,7 +125,6 @@
 if (ep == NULL)
TAILQ_INSERT_TAIL(list-el_entries, eg-ee, ee_link);
 EHE_UNLOCK(list);
-mtx_unlock(eventhandler_mutex);
 return(eg-ee);
 }
 

-- 
Jonathan Mini
[EMAIL PROTECTED]

baka^ni desolation... despair... plastic forks...


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message