PERFORCE change 104026 for review

John Baldwin jhb at freebsd.org
Tue Aug 15 15:30:25 UTC 2006


On Tuesday 15 August 2006 09:54, Roman Divacky wrote:
> http://perforce.freebsd.org/chv.cgi?CH=104026
> 
> Change 104026 by rdivacky at rdivacky_witten on 2006/08/15 13:53:34
> 
> 	Lock the emuldata in a case we just created it.
> 	
> 	Pointed out by: jhb
> 
> Affected files ...
> 
> .. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_emul.c#7 
edit
> 
> Differences ...
> 
> 
==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_emul.c#7 
(text+ko) ====
> 
> @@ -100,6 +100,7 @@
>  		if (p == NULL)
>  		   	panic("process not found in proc_init\n");
>  		p->p_emuldata = em;
> +		EMUL_LOCK(&emul_lock);
>  		PROC_UNLOCK(p);
>  	} else {
>  		/* lookup the old one */

Actually, this won't be happy since emul_lock is an sx lock.  Can't acquire an 
sx lock while holding a mutex since the sx lock might sleep.

> @@ -129,6 +130,7 @@
>  
>  
>  	if (child != 0) {
> +		EMUL_UNLOCK(&emul_lock);
>  	   	EMUL_SHARED_WLOCK(&emul_shared_lock);
>     	   	LIST_INSERT_HEAD(&em->shared->threads, em, threads);
>  	   	EMUL_SHARED_WUNLOCK(&emul_shared_lock);
> 

-- 
John Baldwin


More information about the p4-projects mailing list