From owner-p4-projects@FreeBSD.ORG Thu Aug 7 17:53:44 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id ABB89106566B; Thu, 7 Aug 2008 17:53:44 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EA9E1065674 for ; Thu, 7 Aug 2008 17:53:44 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 5CBEB8FC1E for ; Thu, 7 Aug 2008 17:53:44 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m77HrijZ085091 for ; Thu, 7 Aug 2008 17:53:44 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m77HrirB085089 for perforce@freebsd.org; Thu, 7 Aug 2008 17:53:44 GMT (envelope-from ed@FreeBSD.org) Date: Thu, 7 Aug 2008 17:53:44 GMT Message-Id: <200808071753.m77HrirB085089@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 146845 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Aug 2008 17:53:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=146845 Change 146845 by ed@ed_dull on 2008/08/07 17:53:38 Remove the now unused t_threadcnt variable from struct tty. Now we use the safer destroy_dev_sched_cb(), there is no harm to destroy TTY's when threads are still inside the TTY layer through the character devices. Affected files ... .. //depot/projects/mpsafetty/sys/kern/tty.c#16 edit .. //depot/projects/mpsafetty/sys/sys/tty.h#5 edit Differences ... ==== //depot/projects/mpsafetty/sys/kern/tty.c#16 (text+ko) ==== @@ -166,10 +166,9 @@ /* Device is already gone */ tty_unlock(tp); return (ENXIO); - } else { - tp->t_threadcnt++; - return (0); } + + return (0); } static void @@ -177,10 +176,7 @@ { tty_lock_assert(tp, MA_OWNED); - MPASS(tp->t_threadcnt > 0); - tp->t_threadcnt--; - if (tty_opened(tp) || tp->t_threadcnt > 0 || - tp->t_flags & TF_OPENCLOSE) { + if (tty_opened(tp) || tp->t_flags & TF_OPENCLOSE) { /* Device is still opened somewhere */ tty_unlock(tp); return; @@ -245,7 +241,6 @@ tty_unlock(tp); return (EBUSY); } - tp->t_threadcnt++; tp->t_flags |= TF_OPENCLOSE; /* @@ -315,7 +310,6 @@ struct tty *tp = dev->si_drv1; tty_lock(tp); - tp->t_threadcnt++; /* * This can only be called once. The callin and the callout @@ -930,7 +924,7 @@ tty_lock_assert(tp, MA_OWNED); - if (tp->t_sessioncnt != 0 || tp->t_threadcnt != 0 || + if (tp->t_sessioncnt != 0 || (tp->t_flags & (TF_GONE|TF_OPENED)) != TF_GONE) { /* TTY is still in use */ tty_unlock(tp); ==== //depot/projects/mpsafetty/sys/sys/tty.h#5 (text+ko) ==== @@ -79,8 +79,6 @@ #define TF_EXCLUDE 0x1000 /* Exclusive access */ #define TF_BYPASS 0x2000 /* Optimized input path */ #define TF_ZOMBIE 0x4000 /* Modem disconnect received */ - - unsigned int t_threadcnt; /* (t) Threads in cdev */ unsigned int t_revokecnt; /* (t) revoke() count */ /* Buffering mechanisms */