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

Bjoern A. Zeeb bzeeb-lists at lists.zabbadoz.net
Sun Aug 29 22:30:10 PDT 2004


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
> @@ -300,7 +300,9 @@
>
>  			/* 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


More information about the freebsd-current mailing list