Re: mutex Giant not owned at /usr/src/sys/kern/vfs_vnops.c:120

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Mon, 30 Aug 2004 05:29:56 +0000 (UTC)
On Mon, 30 Aug 2004, Robert Watson wrote:

G'morning,

> Could you try the following patch:

seems to work fine; my test program crashes somewhen later cause of
some pthread probelm but modules got loaded successfully w/o panic.

> Index: ng_socket.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/netgraph/ng_socket.c,v
> retrieving revision 1.53
> diff -u -r1.53 ng_socket.c
> --- ng_socket.c	31 Jul 2004 21:32:55 -0000	1.53
> +++ ng_socket.c	30 Aug 2004 04:17:38 -0000
> _at__at_ -300,7 +300,9 _at__at_
>
>  			/* Not found, try to load it as a loadable module */
>  			snprintf(filename, sizeof(filename), "ng_%s", mkp->type);
> +			mtx_lock(&Giant);
>  			error = linker_load_module(NULL, filename, NULL, NULL, &lf);
> +			mtx_unlock(&Giant);
>  			if (error != 0) {
>  				FREE(msg, M_NETGRAPH_MSG);
>  				goto release;
>
> This causes Giant to be acquired in the event we enter the linker code
> (and hence VFS code) via netgraph ngc_send().  It should be safe in this
> context as we enter protocol send routines without mutexes held (i.e., why
> we're also able to do blocking memory allocation here.)

please commit.

> Thanks!

many thanks to you! :-)

-- 
Bjoern A. Zeeb				bzeeb at Zabbadoz dot NeT
Received on Mon Aug 30 2004 - 03:30:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:09 UTC