From owner-p4-projects@FreeBSD.ORG Wed Feb 22 21:40:44 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C433516A423; Wed, 22 Feb 2006 21:40:43 +0000 (GMT) X-Original-To: perforce@freebsd.org 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 9A8BD16A420 for ; Wed, 22 Feb 2006 21:40:43 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4748A43D45 for ; Wed, 22 Feb 2006 21:40:43 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k1MLeh22087723 for ; Wed, 22 Feb 2006 21:40:43 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k1MLegeu087720 for perforce@freebsd.org; Wed, 22 Feb 2006 21:40:42 GMT (envelope-from jhb@freebsd.org) Date: Wed, 22 Feb 2006 21:40:42 GMT Message-Id: <200602222140.k1MLegeu087720@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 92235 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: Wed, 22 Feb 2006 21:40:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=92235 Change 92235 by jhb@jhb_slimer on 2006/02/22 21:40:30 Feh. Affected files ... .. //depot/projects/smpng/sys/kern/kern_timeout.c#29 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_timeout.c#29 (text+ko) ==== @@ -472,7 +472,7 @@ struct callout *c; int safe; { - int rval, use_mtx; + int use_mtx; if (!safe && c->c_mtx != NULL) { #ifdef notyet /* Some callers do not hold Giant for Giant-locked callouts. */ @@ -488,8 +488,8 @@ mtx_lock_spin(&callout_lock); /* * If the callout isn't pending, it's not on the queue, so - * don't attempt to remove it from the queue. We can try - * to stop it by other means however. + * don't attempt to remove it from the queue. We can try to + * stop it by other means however. */ if (!(c->c_flags & CALLOUT_PENDING)) { c->c_flags &= ~CALLOUT_ACTIVE; @@ -498,32 +498,37 @@ * If it wasn't on the queue and it isn't the current * callout, then we can't stop it, so just bail. */ - if (c != curr_callout) - rval = 0; - else if (safe) { + if (c != curr_callout) { + mtx_unlock_spin(&callout_lock); + return (0); + } + + if (safe) { /* - * The current callout is running (or just about to - * run) and blocking is allowed, so just wait for - * the current invocation to finish. + * The current callout is running (or just + * about to run) and blocking is allowed, so + * just wait for the current invocation to + * finish. */ while (c == curr_callout) { callout_wait = 1; msleep_spin(&callout_wait, &callout_lock, "codrain", 0); } - rval = 0; } else if (use_mtx && !curr_cancelled) { /* - * The current callout is waiting for it's mutex - * which we hold. Cancel the callout and return. - * After our caller drops the mutex, the callout - * will be skipped in softclock(). + * The current callout is waiting for it's + * mutex which we hold. Cancel the callout + * and return. After our caller drops the + * mutex, the callout will be skipped in + * softclock(). */ curr_cancelled = 1; - rval = 1; + mtx_unlock_spin(&callout_lock); + return (1); } mtx_unlock_spin(&callout_lock); - return (rval); + return (0); } c->c_flags &= ~(CALLOUT_ACTIVE | CALLOUT_PENDING);