Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Aug 2008 13:35:56 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        hackers@freebsd.org
Subject:   Re: Linker deadlock.
Message-ID:  <20080803113555.GD2371@garage.freebsd.pl>
In-Reply-To: <20080803110925.GR97161@deviant.kiev.zoral.com.ua>
References:  <20080803073240.GC2371@garage.freebsd.pl> <20080803110925.GR97161@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--raC6veAxrt5nqIoY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Aug 03, 2008 at 02:09:26PM +0300, Kostik Belousov wrote:
> Source line backtraces would be nicer, since gcc inliner forces me to make
> a guess. It seems that linker_load_module() calls linker_load_file()
> that drops and reaquires the linker lock.
>=20
> Then, it seems that dropping the module' vnode lock around the call to
> linker_load_dependencies() should help.

Yes, it doesn't deadlock now, thanks!

> diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
> index 2664ba9..52b3f8f 100644
> --- a/sys/kern/link_elf.c
> +++ b/sys/kern/link_elf.c
> @@ -802,7 +802,9 @@ link_elf_load_file(linker_class_t cls, const char* fi=
lename,
>  	goto out;
>      link_elf_reloc_local(lf);
> =20
> +    VOP_UNLOCK(nd.ni_vp, 0);
>      error =3D linker_load_dependencies(lf);
> +    vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY);
>      if (error)
>  	goto out;
>  #if 0	/* this will be more trouble than it's worth for now */
> diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
> index d8e9219..657dd0e 100644
> --- a/sys/kern/link_elf_obj.c
> +++ b/sys/kern/link_elf_obj.c
> @@ -798,7 +798,9 @@ link_elf_load_file(linker_class_t cls, const char *fi=
lename,
>  	link_elf_reloc_local(lf);
> =20
>  	/* Pull in dependencies */
> +	VOP_UNLOCK(nd.ni_vp);
>  	error =3D linker_load_dependencies(lf);
> +	vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY);
>  	if (error)
>  		goto out;

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--raC6veAxrt5nqIoY
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFIlZgbForvXbEpPzQRAj1EAJ9k4hyfgNWIhFcD2MVgnpC5ugDjsACfSZKj
DXo4yKsxYhtzEbukmnj4ZmU=
=gGqn
-----END PGP SIGNATURE-----

--raC6veAxrt5nqIoY--



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