Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Oct 2009 20:51:15 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Harald Schmalzbauer <h.schmalzbauer@omnilan.de>
Cc:        freebsd-current@freebsd.org
Subject:   Re: shutdown not working with uart console
Message-ID:  <20091010175115.GC2259@deviant.kiev.zoral.com.ua>
In-Reply-To: <4AD0BAFB.6020207@omnilan.de>
References:  <4AD0BAFB.6020207@omnilan.de>

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

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

On Sat, Oct 10, 2009 at 06:48:59PM +0200, Harald Schmalzbauer wrote:
> Dear coders,
>=20
> I recognized one RELENG_8 problem when trying to shutdown via serial=20
> console. While shutdown via SSH works like expected, when called via=20
> serial console it keeps hanging forever.
> I compiled a debug kernel for my embedded device and got the following=20
> backtrace:
> ~KDB: enter: Line break on console
> [thread pid 1102 tid 100074 ]
> Stopped at      kdb_enter+0x3b: movl    $0,kdb_why
> db> bt
> Tracing pid 1102 tid 100074 td 0xc36c26c0
> kdb_enter(c08aca1d,c08b61ae,d5c5e894,c35a0180,0,...) at kdb_enter+0x3b
> uart_intr(c35a0100,c36c26c0,c344a900,c347b0d0,4,...) at uart_intr+0x298
> intr_event_handle(c344a900,d5c5e8ac,c36c26c0,c37a9ad0,1ce,...) at=20
> intr_event_handle+0x4b
> intr_execute_handlers(c347b0d0,d5c5e8ac,0,d5c5e90c,c0852ed4,...) at=20
> intr_execute_handlers+0x48
> lapic_handle_intr(38,d5c5e8ac) at lapic_handle_intr+0x3a
> Xapic_isr1() at Xapic_isr1+0x34
> --- interrupt, eip =3D 0xc05d0814, esp =3D 0xd5c5e8ec, ebp =3D 0xd5c5e90c=
 ---
> _lockmgr_assert(c37a9ad0,1,c08d41d6,1ce,d5c5e940,...) at=20
> _lockmgr_assert+0x13e
> __lockmgr_args(c37a9ad0,100000,c37a9aec,0,0,...) at __lockmgr_args+0x16b
> vop_stdunlock(d5c5e9ec,0,c36c26c0,80000,c37a9a78,...) at vop_stdunlock+0x=
55
> VOP_UNLOCK_APV(c0912b40,d5c5e9ec,c091d71c,c09477e0,c37a9a78,...) at=20
> VOP_UNLOCK_APV+0x9a
> _vn_lock(c37a9a78,80100,c08d4ec2,823,c08c5fec,...) at _vn_lock+0xbc
> vget(c37a9a78,80100,c36c26c0,4f3,c37a9a78,...) at vget+0x61
> devfs_revoke(d5c5eaa4,d5c5eaa4,c08c2b09,157,c36cf330,...) at=20
> devfs_revoke+0x210
> exit1(c36c26c0,1,c08c78e8,ab6,3,...) at exit1+0x9ff
> sigexit(c36c26c0,1,c08c78e8,a49,0,...) at sigexit+0x84
> postsig(1,64,c08cc013,df,c36cf2a8,...) at postsig+0x34d
> ast(d5c5ed38) at ast+0x42f
> doreti_ast() at doreti_ast+0x17
>=20
> I have no idea where the problem is, nor how to get more info.
> Any help appreciated.

I wondering whether I was too conservative in r195509.
Please try this.

diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 39b48e0..b96cdbf 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -340,10 +340,10 @@ exit1(struct thread *td, int rv)
=20
 		if (ttyvp !=3D NULL) {
 			sx_xunlock(&proctree_lock);
-			vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY);
-			if (ttyvp->v_type !=3D VBAD)
+			if (vn_lock(ttyvp, LK_EXCLUSIVE) =3D=3D 0) {
 				VOP_REVOKE(ttyvp, REVOKEALL);
-			VOP_UNLOCK(ttyvp, 0);
+				VOP_UNLOCK(ttyvp, 0);
+			}
 			sx_xlock(&proctree_lock);
 		}
 	}

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkrQyZMACgkQC3+MBN1Mb4gSHACglARbQ/Bc31BLaGw5AfDti9VN
6aoAoO5TSrtBfOWDKT5rvZhlrUYSntuY
=46W4
-----END PGP SIGNATURE-----

--hH1sCSVFCbBgKiGT--



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