Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2002 09:11:05 -0800
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        Jonathan Mini <mini@haikugeek.com>
Cc:        "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>, freebsd-current@FreeBSD.ORG
Subject:   Re: two lock order reversals
Message-ID:  <20020403091105.A37639@troutmask.apl.washington.edu>
In-Reply-To: <20020402182540.B80692@stylus.haikugeek.com>; from mini@haikugeek.com on Tue, Apr 02, 2002 at 06:25:40PM -0800
References:  <200204030111.g331BDCP033703@troutmask.apl.washington.edu> <20020402182540.B80692@stylus.haikugeek.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 [kargl@troutmask.apl.washington.edu] 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 -0000	1.16
> +++ sys/kern/subr_eventhandler.c	3 Apr 2002 02:21:29 -0000
> @@ -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
> mini@haikugeek.com
> 
> <baka^ni> desolation... despair... plastic forks...
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message

-- 
Steve

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020403091105.A37639>