Re: shutdown not working with uart console

From: Kostik Belousov <kostikbel_at_gmail.com>
Date: Sat, 10 Oct 2009 20:51:15 +0300
On Sat, Oct 10, 2009 at 06:48:59PM +0200, Harald Schmalzbauer wrote:
> Dear coders,
> 
> I recognized one RELENG_8 problem when trying to shutdown via serial 
> console. While shutdown via SSH works like expected, when called via 
> serial console it keeps hanging forever.
> I compiled a debug kernel for my embedded device and got the following 
> 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 
> intr_event_handle+0x4b
> intr_execute_handlers(c347b0d0,d5c5e8ac,0,d5c5e90c,c0852ed4,...) at 
> intr_execute_handlers+0x48
> lapic_handle_intr(38,d5c5e8ac) at lapic_handle_intr+0x3a
> Xapic_isr1() at Xapic_isr1+0x34
> --- interrupt, eip = 0xc05d0814, esp = 0xd5c5e8ec, ebp = 0xd5c5e90c ---
> _lockmgr_assert(c37a9ad0,1,c08d41d6,1ce,d5c5e940,...) at 
> _lockmgr_assert+0x13e
> __lockmgr_args(c37a9ad0,100000,c37a9aec,0,0,...) at __lockmgr_args+0x16b
> vop_stdunlock(d5c5e9ec,0,c36c26c0,80000,c37a9a78,...) at vop_stdunlock+0x55
> VOP_UNLOCK_APV(c0912b40,d5c5e9ec,c091d71c,c09477e0,c37a9a78,...) at 
> 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 
> 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
> 
> 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
_at__at_ -340,10 +340,10 _at__at_ exit1(struct thread *td, int rv)
 
 		if (ttyvp != NULL) {
 			sx_xunlock(&proctree_lock);
-			vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY);
-			if (ttyvp->v_type != VBAD)
+			if (vn_lock(ttyvp, LK_EXCLUSIVE) == 0) {
 				VOP_REVOKE(ttyvp, REVOKEALL);
-			VOP_UNLOCK(ttyvp, 0);
+				VOP_UNLOCK(ttyvp, 0);
+			}
 			sx_xlock(&proctree_lock);
 		}
 	}

Received on Sat Oct 10 2009 - 15:51:20 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:56 UTC