From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 3 11:35:59 2008 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 661DE106566C for ; Sun, 3 Aug 2008 11:35:59 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206045140.chello.pl [87.206.45.140]) by mx1.freebsd.org (Postfix) with ESMTP id BB8838FC17 for ; Sun, 3 Aug 2008 11:35:57 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 4192845C8A; Sun, 3 Aug 2008 13:35:56 +0200 (CEST) Received: from localhost (abhw175.neoplus.adsl.tpnet.pl [83.7.112.175]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 21F7845684; Sun, 3 Aug 2008 13:35:49 +0200 (CEST) Date: Sun, 3 Aug 2008 13:35:56 +0200 From: Pawel Jakub Dawidek To: Kostik Belousov Message-ID: <20080803113555.GD2371@garage.freebsd.pl> References: <20080803073240.GC2371@garage.freebsd.pl> <20080803110925.GR97161@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="raC6veAxrt5nqIoY" Content-Disposition: inline In-Reply-To: <20080803110925.GR97161@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: hackers@freebsd.org Subject: Re: Linker deadlock. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Aug 2008 11:35:59 -0000 --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--