From owner-p4-projects Wed Mar 5 12:42:57 2003 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A06D137B406; Wed, 5 Mar 2003 12:42:55 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4CAE837B401 for ; Wed, 5 Mar 2003 12:42:55 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED71943FB1 for ; Wed, 5 Mar 2003 12:42:54 -0800 (PST) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h25Kgs0U092015 for ; Wed, 5 Mar 2003 12:42:54 -0800 (PST) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h25Kgs3f092012 for perforce@freebsd.org; Wed, 5 Mar 2003 12:42:54 -0800 (PST) Date: Wed, 5 Mar 2003 12:42:54 -0800 (PST) Message-Id: <200303052042.h25Kgs3f092012@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 26390 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=26390 Change 26390 by jhb@jhb_laptop on 2003/03/05 12:42:02 Bail out of lock order checking for try lock operations after doing the check for recursion. This fixes a bug with witness and sx_try_slock() (I think) and will make witness properly handle forthcoming changes to mtx_trylock(). Affected files ... .. //depot/projects/smpng/sys/kern/subr_witness.c#77 edit Differences ... ==== //depot/projects/smpng/sys/kern/subr_witness.c#77 (text+ko) ==== @@ -583,14 +583,6 @@ lock_list = PCPU_PTR(spinlocks); /* - * Try locks do not block if they fail to acquire the lock, thus - * there is no danger of deadlocks or of switching while holding a - * spin lock if we acquire a lock via a try operation. - */ - if (flags & LOP_TRYLOCK) - goto out; - - /* * Is this the first lock acquired? If so, then no order checking * is needed. */ @@ -636,6 +628,14 @@ } /* + * Try locks do not block if they fail to acquire the lock, thus + * there is no danger of deadlocks or of switching while holding a + * spin lock if we acquire a lock via a try operation. + */ + if (flags & LOP_TRYLOCK) + goto out; + + /* * Check for duplicate locks of the same type. Note that we only * have to check for this on the last lock we just acquired. Any * other cases will be caught as lock order violations. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message